Re: ldap search problem.
[email protected] (Graham Barr)
| Newsgroups | perl.ldap |
|---|---|
| Message-ID | <[email protected]> |
On Feb 5, 2010, at 1:02 PM, Andrew Meng wrote:
>
> Hello,
>
>
>
> LDAP search failed to return any result but I can get the result back using the same base and filter in ldp.exe. Here is the code:
>
>
>
> !/usr/bin/perl
>
>
> use Net::LDAP;
>
>
>
> $ldap = Net::LDAP->new("server", port =>389) or die 'Could not contact LDAP server';
>
> $ldap->bind("cn=id,DC=aa,DC=bb", password=>"password") or die 'Could not bind';
That line is wrong. bind will ALWAYS return true as it returns a message object. You must check the status code in the object
Graham.