Re: Net::LDAP search of a DN

[email protected] (Chris Ridd)
Newsgroups perl.ldap
Message-ID <[email protected]>
On 18 May 2011, at 18:45, Brian Gaber wrote:

> This dn search of dn=cn=name,o=org works from a command line and returns all the attributes of the dn:
> 
> ldapsearch -h host -x -b "cn=name,o=org"
> 
> However, this Net::LDAP does not return anything:
> 
> $mesg = $ldap->search(base=>"cn=name,o=org");
> 
> I have also tried:
> 
> $mesg = $ldap->search(
>                               base  =>"cn=name,o=org",
>                               scope => 'base'
> );

You should explicitly add the other search arguments to search() that your ldapsearch command-line program is implicitly adding. One obvious one is the search filter - something like "(objectclass=*)" is common.

If that doesn't make a difference you will have to do some investigating and work out what your command-line program is actually sending. Maybe it has debug modes which will help; maybe your server's logs have useful info?

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.