Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net::LDAP How to return DN on a search

Status
Not open for further replies.

jonlake

MIS
Sep 17, 2003
76
US
It seems like this should be so obvious that I'm looking right past it. What I'm trying to do is have a user enter their uid and password, and then bind to the directory server as themself. However, if I do a search for that person
Code:
my $ldap = Net::LDAP->new( '127.0.0.1:4389') or die "$@";
my $base = "ou=people,dc=usfccorp,dc=com";
my $filter = "(&(objectclass=usfperson)(uid=$user))";
$ldap ->bind;
my $user_search = $ldap->search( base=> $base,
                                 filter=> $filter,
);
and then try to get the dn (since nothing is returned, I'm guessing this is something that net::ldap doesn't return)
Code:
foreach my $entry ($user_search->entries) {
  my $userdn = $entry->get_value('dn');
  print "$userdn \n";
}
$ldap->unbind;
I have looked at the cpan pages and done some google searching and haven't found what I'm looking for. It seems to me that this should be so obvious that I'm looking right past it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top