NetReg: Registering a like-user reserve using admin.cgi

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

From: Francisco Orta (forta@ll.iac.es)
Date: Mon Feb 09 2004 - 08:24:59 CST


Hi

   register.cgi adds a line as follows:

>host oper-1 { hardware ethernet 00:50:DA:3C:F7:BB ; ddns-hostname
oper-1;}#Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)#20031007
14:16:08#161.72.64.12

  But the modified admin.cgi (who register static reserves) adds a line
as follows:

> host camaleon { hardware ethernet 00:0d:56:76:e0:e7 ; fixed-address
161.72.94.11 ; }#IAC - trc#20040206 11:02:28

  I would like to add a line like the first one but using admin.cgi,
that is, in the name of the final user. I thought about writing
something like a 'sub dd_reserv_2' into admin.cgi.

The problem is that dhcp.conf.new needs an IP as comment, so I should:

a) add a false entry in the leases file with an already free IP of the pool;

or b) add the IP-comment in dhcpd.conf AFTER the user gets the IP from
the DHCP server.

    What do you about that? Do you have done something like that?

     Thanks,

        Francisco Orta

quick and dirty sub add_reserv_2:

   sub add_reserv_2 {
     if (($FORM{'user_name'}) && ($FORM{'mac_addy'}) &&
($FORM{'platform'})) {
     #User entered host name, mac address, and platform note, check info and
     #add the record (modified from register.cgi::append_host_entry())
       ($SEC,$MIN,$HOUR,$DAY,$MO,$YR) = localtime;
       $YR+=1900; $MO++;
       if ($DAY<10) { $DAY="0$DAY"; }
       if ($MO<10) { $MO="0$MO"; }
       if ($HOUR<10) { $HOUR="0$HOUR"; }
       if ($MIN<10) { $MIN="0$MIN"; }
       if ($SEC<10) { $SEC="0$SEC"; }
       $TIME="$HOUR:$MIN:$SEC";
       #check if MAC_ADDY is already registered
       open (DHCPDCONFNEW, "$DHCPDCONFPATH/dhcpd.conf.new");
       while (<DHCPDCONFNEW>) {
         if ($_ =~ /$FORM{'mac_addy'}/) {
            printf "$FORM{'mac_addy'} Already Exists in DHCPD.CONF.NEW!";
            exit;
         }
         if ($_ =~ /$FORM{'user_name'}/) {
            printf "$FORM{'user_name'} Already Exists in DHCPD.CONF.NEW!";
            exit;
         }
       }
       close(DHCPDCONFNEW);
       $_ = $FORM{'user_name'} ;
       tr/'//d;
       $GOODHOSTNAME = $_;
       open (DHCPDCONFNEW, ">>$DHCPDCONFPATH/dhcpd.conf.new");
       print DHCPDCONFNEW "host $GOODHOSTNAME { hardware ethernet ";
       print DHCPDCONFNEW "$FORM{'mac_addy'} \; ";
       print DHCPDCONFNEW "ddns-hostname $FORM{'user_name'} \; ";
       print DHCPDCONFNEW "}\#$FORM{'platform'}";
       print DHCPDCONFNEW "\#$YR$MO$DAY $TIME";
       print DHCPDCONFNEW "\#$FORM{'ip_addy'}\n";
       close(DHCPDCONFNEW);
       printf "$FORM{'user_name'} $FORM{'mac_addy'} $FORM{'ip_addy'}";
     }
     else {
     #no form data entered, print the entry form
     printf "<form method=get action=$ADMINPATH/admin.cgi>";
     printf "<input type=hidden name=action value=AR2>";
     printf "<ul><b> Enter information for like-guess IP
Reservation/Registration
without an IP Address</b><p>";
     printf "<pre>";
     printf " Username: <input type=text name=user_name><P>";
     printf "Mac Address: <input type=text name=mac_addy><P>";
     printf "Description: <input type=text name=platform><P>";
     printf " IP Address: <input type=text name=ip_addy><P>";
     printf "</pre></ul>";
     printf "<input type=submit>";
     }
   }

**********************************************************************
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:44 CDT