The simplest way to do this is to search the entire master directory, and iterate over the record set.
use strict;
use Net::LDAP;
my $ld = Net::LDAP->new('myserver');
$ld->bind(dn=>'username',password=>'passwd');
my $result = $ld->search(base=>'cn=mydir',
scope=>'sub',
filter=>'(objectclass=*)');
while (my $entry = $result->entry())
{
#do comparison here
}
You'll probably need to use page support and/or async searching if your directory contains much in the way of data.
One thing to watch out for: I've done this sort of thing a few times, and tended to find that detecting when entries/attributes aren't there is the trickiest bit. It's also worth noting that there are commercial apps available that will do this sort of thing for you.
--------------------------------------------------------------
"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."
John Brunner, "The Shockwave Rider".
|