[1856] in Moira
don't allow strings with control characters
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Wed Aug 22 16:12:46 2001
Message-Id: <200108222012.QAA23067@brad-majors.mit.edu>
To: moiradev@MIT.EDU
Date: Wed, 22 Aug 2001 16:12:43 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Laura sent me mail about someone who added a string with a ^H in
it to a list. I can't think of any reason you'd actually want to do
this, so here's code to make libmrclient check for it.
Garry
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/22 19:45:33
@@ -24,7 +24,19 @@
int mrcl_validate_string_member(char *str)
{
- char *p, *lname;
+ char *p, *lname, *ret;
+
+ ret = strdup(str);
+ while (*++ret)
+ {
+ if (iscntrl(*ret))
+ {
+ mrcl_set_message("STRING \"%s\" contains control characters, "
+ "which are not allowed.", str);
+ free(ret);
+ return MRCL_REJECT;
+ }
+ }
p = strchr(str, '@');
if (p)