From: Chris R. <not...@ho...> - 2002-07-02 18:22:39
|
ok, I am still having problems with the get_dn here is the relevant code: my $ldap = Net::LDAP -> new($ldapServer, port => $ldapPort, debug=>1) or die "LDAP Server Connection Failed :$error"; #Annonymous Query to LDAP baseed on DN my $results = $ldap->search( base => $baseDN, scope => "sub", filter => ($matchAttr==$name), attrs => $attrs ); # request all available attributes my @Attrs = (); #check for search error if ($error == $results->code()){ die "Critical LDAP search failed:$error,$results->filter(0)"; } if ($results->count()) { die"User entry not found for filter:&results->filter"; } #get DN $ent = $results -> shift_entry(); $dn = $ent -> dn(); #line 39 #bind user $mesg =$ldap->bind(dn=>$dn, password=>$password); and the error messege I get is: Can't call method "dn" on an undefined value at ldapauth.pl line 39. >From: Bob Goolsby <go...@at...> >To: Chris Ronstadt <not...@ho...> >Subject: Re: get_dn >Date: Fri, 28 Jun 2002 16:56:37 -0700 > >bind() gives you a connection to the Directory, not an individual entry. >You need to go through a successful search use the Entry(s) returned to >get the DN. >As in: > > $ldap = Net::LDAP->new() > $conn = $ldap -> bind(); > $msg = $conn -> search(filter => "cn=bob goolsby"); > $ent = $msg -> shift_entry(); > print("The DN is ", $ent -> dn(), "\n"); > >(Error checking has been omitted to reduce the line cound. The above >was coded but not tested....) > >B > >Chris Ronstadt wrote: > > > > Ok, I got that solved thank you, but now I need to run a get_dn to bind > > properly? > > > > $dn = $result->get_dn; > > > > is that the proper line? and where exactly do I put this line? I keep > > getting told: can't call method on undefined line > > > > _________________________________________________________________ > > MSN Photos is the easiest way to share and print your photos: > > http://photos.msn.com/support/worldwide.aspx > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Caffeinated soap. No kidding. > > http://thinkgeek.com/sf > >-- >Bob Goolsby >go...@at... > >The only thing with more energy than a puppy with a bone is a puppy with >*two* bones. _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |