Re: [Cpu-users] fix for bug #729512 (cpu useradd/groupadd failes for uid/gid containing dashes)
Brought to you by:
matheny
From: Blake M. <bma...@pu...> - 2003-05-01 20:21:11
|
Fixed, apologies. -Blake Paul Stevens wrote: > Blake Matheny wrote: > >> Hello Paul, >> I looked at the posix specs, and according to them the character class >> [A-Za-z0-9._-] is legal for a username, and the hyphen should not be >> the first character of the username. I have fixed this in CVS. Thanks. > > > Which broke cpu all together due to inverted boolean logic. > > I'm even getting some gdb practice off cpu :-) > > I think the following patch will fix this. > > > Index: src/plugins/ldap/commandline.c > =================================================================== > RCS file: /cvsroot/cpu/cpu/src/plugins/ldap/commandline.c,v > retrieving revision 1.9 > diff -u -r1.9 commandline.c > --- src/plugins/ldap/commandline.c 29 Apr 2003 23:19:53 -0000 1.9 > +++ src/plugins/ldap/commandline.c 30 Apr 2003 08:27:21 -0000 > @@ -361,9 +361,9 @@ > return -1; > } > } > - if ( !isalnum(argv[optind+1][k]) || > - argv[optind+1][k] != '.' || > - argv[optind+1][k] != '-' || > + if ( !isalnum(argv[optind+1][k]) && > + argv[optind+1][k] != '.' && > + argv[optind+1][k] != '-' && > argv[optind+1][k] != '_' ) > { > CTEST(); > >> >> -Blake >> >> Paul Stevens wrote: >> >>> >>> Blake, >>> >>> I would propose a small fix that will close bug #729512 as I've >>> submitted today. >>> >>> I think dashes and numericals are perfectly valid in usernames and >>> groupnames since they are valid in passwd as well. >>> >>> I'm not much of a c-coder, though. >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Index: src/plugins/ldap/commandline.c >>> =================================================================== >>> RCS file: /cvsroot/cpu/cpu/src/plugins/ldap/commandline.c,v >>> retrieving revision 1.7 >>> diff -u -r1.7 commandline.c >>> --- src/plugins/ldap/commandline.c 25 Apr 2003 20:51:45 -0000 1.7 >>> +++ src/plugins/ldap/commandline.c 29 Apr 2003 12:56:11 -0000 >>> @@ -342,7 +342,7 @@ >>> string */ >>> for ( k = 0; k < strlen(argv[optind+1]); k++ ) >>> { >>> - if ( !isalpha(argv[optind+1][k]) ) >>> + if ( !isalnum(argv[optind+1][k]) && !ispunct(argv[optind+1][k]) ) >>> { >>> CTEST(); >>> printHelp(operation); >> >> >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> Cpu-users mailing list >> Cpu...@li... >> https://lists.sourceforge.net/lists/listinfo/cpu-users >> > > |