From: Jim H. <ha...@us...> - 2002-07-18 18:09:03
|
Isaac, First a caution, them some how-to's. The good news about LDAP is that attributes are (or can be) multi-valued. The bad news for this application is that there is no guarantee in the LDAP protocol itself that the values for a given attribute will be returned in any particular order. Many implementations will return them in the order they were added, but that isn't guaranteed under the protocol. The implications of this for your application are that you can't be sure that a given IP pairs up with a given MAC. Again, your implementation may work correcly now, but no guarantees for another directory server or a new version of your current one. If you don't care about pairing, then this isn't an issue at all. If you are fanatic about pairing, then you will need to do something like define a new attribute. This might be called something like ipMac and have values like 123.321.123.321|ab:cd:ef:01:23:45. You would search for an IP with a filter like "ipMac = $ip|*" or for a MAC with "ipMac = *|$mac". That said, the rest of this assumes you don't care about pairing or trust your implementation. The last 4 lines of your $CreateArray would look like ipHostNumber => [$client_IP, $modem_IP], macAddress => [$client_MAC, $query->param('modem_MAC')] To add additional values, just use $ldap->modify($dn, add { ipHostNumber => [$client_IP, $modem_IP], macAddress => [$client_MAC, $query->param('modem_MAC')] } --Jim Harle On Thu, 18 Jul 2002, Isaac wrote: > I am working on a cablemodem registration script that collects > information on the user, and stores it in an ldap database. So far > everything is working fine, but I'm not sure how I should go about > implementing the next stage. > > As it is the database requires that I store 2 ip addresses and 2 mac > addresses for each user (one for the modem, and one for the client). My > question is this: How do I distinguish between the modem mac address/ip > and the client? > > Also, at the moment, if the user registers a new device on the network > their old entry is overwritten. I would like the user to be able to > register multiple devices, and to have the database keep distinct > records for each device. > > Here is how the attributes are laid out in my script: > > $CreateArray = [ > objectClass => > ["ipHost","ieee802Device","person","organizationalPerson"], > cn => $query->param('login'), > sn => $query->param('name'), userPassword => $query->param('pass') > , > street => $query->param('address'), > telephoneNumber => $query->param('phone'), > ipHostNumber => $client_IP, > macAddress => $client_MAC, > ipHostNumber => $modem_IP, > macAddress => $query->param('modem_MAC'), > ]; > > Thank you for your time, > > -Isaac Davis-King > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > |