I'm writing some perl to query a field in our config and I'm getting strange results.
First of all if I use ldsearch the query works find:
$ ldapsearch -h <our ldap server> -p <our ldap port> -b cn=config -D "cn=directory manager" -w <our secret password> "cn=config" passwordInHistory
returns: cn=config passwordInHistory=6
cn=config,cn=chaining database,cn=plugins,cn=config
cn=config,cn=ldbm database,cn=plugins,cn=config
Strangly the same query in perl returns no results. Here is a cut and paste of my perl code:
$mesg = $ldap->search( base => "cn=config", filter => "cn=config", attrs => ["passwordInHistory"] ); $mesg->code && die $mesg->error;
print $mesg->count, "\n"; print $mesg->code, "\n";
The results of running this code segment is to print out two 0's. No count and no error code. But the search criteria is the same that we send to ldap search and our bind done further up in the perl code binds to the same address and port as the same user and password.
What could be causing this strange behavior?
Also strangely enough this query returns no results for either ldapsearch or perl:
$ ldapsearch -h <our ldap machine> -p <our ldap port> -b cn=config -D "cn=directory manager" -w <our secret password> "passwordInHistory=*" passwordInHistory
No results.
The ldap logs show the queries from ldapsearch and perl to be identical even though they show ldapsearch returning 1 match while perl returns 0.
Any one have any hints as to what I am doing wrong?
Thanks.