Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Comparing ldap data using net ldap

by g0n (Priest)
on Jan 26, 2007 at 09:47 UTC ( [id://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".

Replies are listed 'Best First'.
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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-25 07:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found