RE: Converting login user IDs to lowercase

David Cecil (davidc@dcmicro.com)
Thu, 17 Oct 1996 12:02:03 -0400

> Has anyone hacked radius to convert the user supplied User ID to=20
> lowercase before trying to look it up in the users file and/or get the =

> password out of /etc/passwd? (My C ability is rather limited, else I'd =
do=20
> it myself)

I've not done this myself, but it should be relatively straightforward. =
You can use C's strlwr() function to convert a string to lowercase. The =
tolower() function converts a single character, not the entire string.

If your system doesn't support strlwr(), you can create your own like =
this:

char * strlwr( char * s )
{
char * ptr ;

/* loop through string, character by character */
ptr =3D s ;
while ( *ptr ) /* until we reach end of string */
*ptr++ =3D tolower( *ptr ) ; /* convert each individual =
character to lowercase */

return s ; /* return a pointer to the start of the string */
}

You''l want to modify the rad_authenticate() routine in radiusd.c to =
convert namepair->strvalue to lowercase. Do this near the beginning of =
the routine, before it calls the user_find() function. The syntax is:

strlwr( namepair->strvalue ) ;

I presume this is intended to overcome problems of users leaving caps =
lock on or capitalizing their login names. As the other fellow =
mentioned, this may not be practical unless you also force everyone to =
use lowercase passwords.

Hope this helps,
David Cecil
ConnectUp, Inc.
davidc@connectup.com