Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Traverse LDAP Tree

by dda (Friar)
on Oct 03, 2003 at 07:36 UTC ( [id://296171]=perlquestion: print w/replies, xml ) Need Help??

dda has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everyone!

I can not find a way to build XML file from LDAP directory tree. I'm not looking for out-of-the-box solution, but I can't simply release how can I list child entries for one particular entry. What I have found so far is just the opposite: one can parse DN and get parent DN by simply removing leftmost part of it. But how that can be used for traversing tree?

Any help will be greatly appreciated.

--dda

Replies are listed 'Best First'.
Re: Traverse LDAP Tree
by inman (Curate) on Oct 03, 2003 at 08:13 UTC
    Consider working with LDIF as a method of working with LDAP entries in bulk. You could use the LDIF tool that ships with all LDAP servers (e.g. OpenLDAP). LDIF produces a text file that you can parse and convert into XML (an easy and reliable route).

    You could also use the Net::LDAP and Net::LDAP::LDIF modules. This method slurps the LDIF output into memory which may cause problems for large directories.

    Inman

      Thanks for replying, inman. Sure, I know what LDIF is and how to get all entries with Net::LDAP. But is there a way to build a tree, like all GUI LDAP browsers do?

      --dda

Re: Traverse LDAP Tree
by Anonymous Monk on Oct 07, 2003 at 12:43 UTC
    This returns entries for all children of $dn:
    $mesg = $ldap->search(base=>$dn, scope=>'one', filter=>'objectClass=*');
      Dear Anonymous Monk, your suggestion works just fine! Thanks again.

      --dda

      I will try this, but I'm afraid that one 'big' search is much faster than a lot of 'small' searches.

      Thanks!

      --dda

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://296171]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-26 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found