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

Janitor's note: Was entitled "Write down these almost dead tired me, but I am ready to see answer to death;I have a question abort "perl ldap _search""

My English is very poor,so I'm sorry first!~If you can see I've been very thank 。 after AD server upgrade to Windows Server 2008,One of my perl script encountered a problem. error is :"Net::LDAP::Search=HASH(0xf47e00)" In a other “OU”or change scope => 'one' or 'base' ,Error will disappeared (OU is not wrong.) thanks first

# LDAP server my $LDAP_BASE = 'OU=Aaa,DC=internal,DC=aaa,DC=com'; # LDAP search ba +se my $LDAP_SERVER = 'xxx-yyy.zzz.aaa.com'; my $LDAP_DN = 'readonly'; my $LDAP_PASSWORD = 'passwd'; my $filter = "(&(objectClass=person))"; # connect to LDAP server my $ldap = Net::LDAP->new($LDAP_SERVER, onerror => \&sendMail); if (!defined($ldap)) { &sendMail("Failed to connect to LDAP Server [$LDAP_SERVER]"); } # bind account my $result = $ldap->bind($LDAP_DN, password => $LDAP_PASSWORD); if ($result->code()) { &sendMail("AD bind failed"); } # get account information $result = $ldap->search( base => $LDAP_BASE, scope => 'sub', # entire tree timelimit => 600, filter => $filter, attrs => ['sAMAccountName','mail'], );

Replies are listed 'Best First'.
Re: Problem with LDAP query
by davido (Cardinal) on Dec 14, 2012 at 17:29 UTC

    A couple of suggestions:

    One: Use Data::Dumper to inspect what's in that hashref. Might be interesting (or informative).

    Two: Coinciding with your server upgrade, did you upgrade your version of Net::LDAP, or one of its dependencies? If you're VC'ing your module stack you might be able to roll back to a previous stack of module versions, possibly to good effect.

    Outside of that, I'm out of ideas. Hopefully now that your node has been edited so that it's somewhat legible someone with some experience with Net::LDAP can chime in.


    Dave