From: Robert Lowe (robert.h.lowe@lawrence.edu)
Date: Tue Sep 03 2002 - 08:21:23 CDT
"King, Michael" wrote:
The quote below was from me... this was fixed in the CIDR kit. In
fact, there have been enough minor issues reported, that I would hope
a new RC would be put forth, whether or not it includes features or
functionality included in the CIDR kit, or the present alpha OMAPI
kit.
-Robert
> Eric,
>
> I pulled this from the archive.
>
> Yes, in the append_host_entry routine, there is a regular expression
> that matches the username in a dhcpd.conf entry. The code looks like:
>
> if ($_ =~ /$FORM{'user'}/) {
> ($TRASH, $HOST) = split /\s/;
> push (@HOSTS, $HOST);
> }
>
> It should probably be something like:
>
> if (/host $FORM{'user'}-/) {
>
> ...
>
> Just replace the if line from the top with the one on the bottom. It's
> remarkable simliar, but there are a few changes. I do not read Perl yet,
> but it's the next item on my study list.
>
> -----Original Message-----
> From: Eric Gauthier [mailto:elg@bu.edu]
> Sent: Monday, September 02, 2002 11:22 AM
> To: netreg@southwestern.edu
> Subject: NetReg: Counting issue
>
> Hello,
>
> We encountered a strange problem here at BU that appears related to a bug in
> the REGEX that figures out how many (if any) hosts a user has already
> registered. The logic of the script (sub append_host_entry) appears to go
> like this. First, open the dhcpd.conf file and look to see if the MAC is
> already registered by searching for the MAC. If they have already
> registered then stop. Next, open the dhcpd.conf file and find all of the
> hosts that this user has registered by searching for their username. Look
> at the last entry that you find. This entry should be listed as
> <username>-<serial number> so split off the number following the "-",
> increment by one, and make this the new serial number.
>
> Here's the problem we ran into. Student A has a username like "bobsv" and
> he registers his desktop which now has the host entry "bobsv-1". Student B
> comes along with a username of "sv" and he registers his desktop. When
> register.cgi looks through the config file, the REGEX looks for /sv/ and
> matches "bobsv-1", parses it and increments the serial number to 2, and thus
> enters Student B's desktop as "sv-2". Now, along comes Student C with a
> username of "robsv" and he registers his desktop which gets the host entry
> of "robsv-1". The conf file now looks like:
> host bobsv-1 ...
> host sv-2 ...
> host robsv-1 ...
> If student B comes back to the system and attempts to register a laptop, the
> system will look through the config file with the REGEX /sv/ and the last
> match that it finds is "robsv-1". Register.cgi parses this and increments
> the serial number to 2 and adds Student B's laptop as "sv-2".
> Unfortunately, now there are two host entries for "sv-2" with different MAC
> addresses so when the server reloads there are issues :)
>
> The fix appears to be pretty easy. Just modify the REGEX in register.cgi's
> append_host_entry subroutine to be more explicit. Since none of our
> hostname's contain a dash ("-"), we do a search for "/^host $FORM{'user'}-/"
> instead of "/$FORM{'user'}/". Having the match begin with the word "host"
> followed by a space will prevent it from failing for students who have
> usernames that are something funky like "ethernet" (or any username that
> might be a substring of some comment the browser might send in another users
> registration) and, since none of our usernames have dashes, the trailing "-"
> in the pattern match should make it only find an exact match for the
> username. Here's the diff against the script we're testing.
>
> 175c175
> < if ($_ =~ /$FORM{'user'}/) {
> ---
> > if ($_ =~ /^host $FORM{'user'}-/) {
>
> I'm really not that great at REGEX, so can someone else take a look at this
> and see if this might also fail in some bizarre way? Or, better yet, has
> someone else already resolved this?
>
> Thanks!
>
> Eric Gauthier
> Network Engineer
> 617-353-8218 ~^~ elg@bu.edu
> Boston University - Office of IT
>
> **********************************************************************
> 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
> **********************************************************************
**********************************************************************
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
**********************************************************************
This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:38 CDT