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
and then try to get the dn (since nothing is returned, I'm guessing this is something that net::ldap doesn't return)
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.
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,
);
Code:
foreach my $entry ($user_search->entries) {
my $userdn = $entry->get_value('dn');
print "$userdn \n";
}
$ldap->unbind;