From: Graham B. <gb...@po...> - 2000-11-30 06:22:40
|
I do seem to recall a bug in this part of the code in a previous release. What version of Net::LDAP do you have installed ? Graham. On Wed, Nov 29, 2000 at 04:29:35PM -0900, Brian Avis wrote: > Hello all, > > Having problems with ldap search and was hoping someone could help me > out. > > I am writing a utility to let our admin staff add and remove a user from > a group or a list of groups on the ldap server. > > So when the username is entered one of the first things I check is > whether that user is in the LDAP server or not.... if they are then get > their DN. > > This is the code in question. > > $mesg = $connection->search(base => $basedn, > filter => "(uid=$uid)", > timelimit => 10); > > > if ($mesg->code) { > print $mesg->code." ".$mesg->error; > print "\n"; > } else { > > my $entry; > while ($entry = $mesg->pop_entry()) { > > $entry = $mesg->pop_entry(); > > } > } > > if (!defined $entry) { > print "\n$realname is not a valid user in the LDAP server\n"; > redo; > } > > my $userDN = $entry->dn(); > > > The funny thing is that this was working for a couple of days but has > quit working this afternoon. Go figure. Now though, when it gets to the > $entry = $mesg->pop_entry(); line it hangs. The programs stops > responding (and yes I waited a good long time for it to come back). When > I looked up the pop_entry bit in the documentation this is all I found. > > pop_entry > Pop an entry from the internal list of Net::LDAP::Entry > objects for this search. If there are not more entries > then undef is returned. > > This call will block, if the list is empty, until the > server returns another entry. > > The last bit where it says this call will block if list is empty is > probably what is causing me problems. > > So I guess the question is what is the best way to tell if a user exists > in the LDAP server and if they do exists what is the best way to return > their DN? > > Thanks in advance for the help. > > -- > Brian Avis > SEARHC Medical Clinic > Juneau, AK 99801 > (907) 463-4049 > If nautical nonsense be something you wish. > Then drop on the deck and flop like a fish. > |