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 |