[1858] in Moira

home help back first fref pref prev next nref lref last post

Re: don't allow strings with control characters

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Wed Aug 22 22:27:06 2001

Message-Id: <200108230227.WAA06577@gorf.mit.edu>
To: Robert A Basch <rbasch@MIT.EDU>
cc: Garry Zacheiss <zacheiss@MIT.EDU>, moiradev@MIT.EDU
In-Reply-To: Your message of "Wed, 22 Aug 2001 18:35:21 EDT."
             <200108222235.SAA08144@anhedonia.mit.edu> 
Date: Wed, 22 Aug 2001 22:27:04 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>

	Oh, fine.  "Bad hair day."   Let's try that again.

Index: member.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/member.c,v
retrieving revision 1.3
diff -u -r1.3 member.c
--- member.c	2000/08/25 23:06:56	1.3
+++ member.c	2001/08/23 02:24:44
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #include <krb.h>
 
@@ -24,7 +25,17 @@
 
 int mrcl_validate_string_member(char *str)
 {
-  char *p, *lname;
+  char *p, *lname, *ret;
+
+  for (ret = str; *ret; ret++)
+    {
+      if (iscntrl(*ret))
+	{
+	  mrcl_set_message("STRING \"%s\" contains control characters, "
+			   "which are not allowed.", str);
+	  return MRCL_REJECT;
+	}
+    }
 
   p = strchr(str, '@');
   if (p)

home help back first fref pref prev next nref lref last post