Re: Converting login user IDs to lowercase

DT Scott (dtscott@scott.net)
Sun, 20 Oct 1996 01:39:14 -0500 (CDT)

Scott:

I'm just catching up on reading the digests from the last couple days...
I read the other responses to your post and thought I'd give you real code
that has been running in ours for a good while now (see below). Note that
as some noted, if caps lock is on it won't help, but we find that many,
many users put in things like:
Tom
JoeSmith
ZORRO (intentionally all upper case - not caps lock).
and other such things. I'd say it cut our trouble calls down a good bit
when we put it in place. It's really amazing to check the portmasters and
see the various things people do to their logins!

Remember to warn them that TELNET's, FTP's, and POP mail must be lower
case, tho' - unless you hack them too (I did POP but not the others).

Later!

Derric

> Has anyone hacked radius to convert the user supplied User ID to
> 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
> it myself)

Note, ONLY the last two lines are necessary for the hack - the other stuff
I just included to help you find your place. It goes in file radiusd.c
around line #917. There may be some string functions in C to make is
simpler, but it wasn't worth the time to try to find them (man pages
sometimes don't help you find things like that).
-----
/* Get the username from the request */
namepair = authreq->request;
while(namepair != (VALUE_PAIR *)NULL) {
if(namepair->attribute == PW_USER_NAME) {
break;
}
namepair = namepair->next;
}
if((namepair == (VALUE_PAIR *)NULL) ||
(strlen(namepair->strvalue) <= 0)) {
sprintf(msg, "Authenticate: from %s - No User Name\n",
ip_hostname(authreq->ipaddr));
log_err(msg);
pairfree(authreq->request);
memset(authreq, 0, sizeof(AUTH_REQ));
free(authreq);
return;
}

/* DTS added 14Mar to get rid of annoying case problems with logins!
* Setup and tested 24Jun96 - seems ok ...
*/
for( ptr = namepair->strvalue; *ptr; ptr++ ) {
*ptr = tolower(*ptr);
}

-- 
Derric Scott          Scott Network Services, Inc.         P. O. Box 361353
derric@scott.net           (205)987-5889               Birmingham, AL 35236