Re: NetReg: Sanitizing DHCP conf entry

New Message Reply Date view Thread view Subject view Author view Attachment view

From: Matthew Perry (mperry4@mail.lesley.edu)
Date: Mon Nov 04 2002 - 08:14:02 CST


         Hey,

         I'm not sure if the script does any checking on the username. I
have written some code that takes of the @lesley.edu here at Lesley. It
also gets rid of caps and space. I'm sure you could just put a line into
it to remove /. All though you might want to just put in something like
"$FORM{'user'} =~ /\// && error( "Sorry / not a valid character");"

         Below is the code I wrote to change the username. You want to put
this sub call in register.cgi right after the call to check_input. You
could put the check for "/" in check_input. Feel free to use this code and
change it for your school.

## Removes @...lesley.edu, spaces and converts to lowercase
sub fix_name {
         if ($FORM{'user'} =~ /\@.*?lesley\.edu/i) { #check for @...
                 ($FORM{'user'}, $trash) = split (/\@/,
$FORM{'user'}); #remove @...
         }
         $FORM{'user'} =~ s/ //g; #remove spaces
         $FORM{'user'} =~ tr/A-Z/a-z/; #Change uppercase to lowercase
         $FORM{'user'} =~ /\// && error("Invalid username."); # Line to
check for /
}
## code ends

At 04:54 PM 11/1/2002 -0500, you wrote:
>Hello,
> Recently, I had one of my clueless users enter a / in his login
>information. Unfortunately, it worked and dhcpd process to have a hissy
>fit.
>
> Can someone point me to where it cleans the username entered so I can add
>this character to it?
>
>Thanks,
>Pat
>**********************************************************************
>To unsubscribe from this list, send an e-mail message to
>majordomo@southwestern.edu containing a single line with the words:
>unsubscribe netreg
>Send requests for assistance to: owner-netreg@southwestern.edu
>**********************************************************************

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:38 CDT