From: Steve Hideg (hideg@saintmarys.edu)
Date: Tue May 15 2001 - 12:39:52 CDT
At 10:55 AM -0500 5/15/01, Peter Valian wrote:
>yes steve...you can post the code to the list if you like.
>
>Steve Hideg wrote:
>>
>> I wrote code to do this that isn't part of the "official"
>> distribution (Peter, are you interested?). I can send it to you.
The subroutine uniqueHostname works this way:
For a given username (in $FORM{'user'}), it checks dhcpd.conf.new to
find all machines whose hostnames contain that username. If any are
found, it appends a "-2", "-3", etc. to the hostname until it creates
one that is unique, then returns this new hostname.
To use this, you need to modify the subroutine append_host_entry in
register.cgi.
The attached file contains TWO subroutines, one is a modified version
of append_host_entry from the 1.2 version distribution. The other is
the subroutine uniqueHostname. You can paste this code into
register.cgi (replacing the existing append_host_entry), or--if
you've already modified append_host_entry or are using a different
distribution--you can follow the steps below, and only paste the code
for uniqueHostname:
After the first close(DHCPDCONFNEW); statement, add the following line:
my $theHost = uniqueHostname($FORM{'user'});
Then change this line:
print DHCPDCONFNEW "host $FORM{'user'} { hardware ethernet ";
to:
print DHCPDCONFNEW "host $theHost { hardware ethernet ";
++Steve
____________________________________________________________________
Steve Hideg
Technical Support Specialist, Saint Mary's College, Notre Dame IN
<hideg@saintmarys.edu>
____________________________________________________________________
"The Internet is a great way to get on the net." --Bob Dole
**********************************************************************
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:35 CDT