Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Comparing ldap data using net ldap

by g0n (Priest)
on Jan 26, 2007 at 09:47 UTC ( #596683=note: print w/ replies, xml ) Need Help??


in reply to Comparing ldap data using net ldap

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".


Comment on Re: Comparing ldap data using net ldap
Download Code
Re^2: Comparing ldap data using net ldap
by klekker (Pilgrim) on Jan 26, 2007 at 10:02 UTC
      Thanks. The callback may work for me since I am walking the entire ldap tree and comparing entries against the secondary ldap entries.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://596683]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-26 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (168 votes), past polls