we are struggling since a few days with a strange ldap error. The following code worked fine for more than a year. Suddenly it returns an local error (0x52)
for a few user CNs.
The relevant code is (connect and bind always work, only the search fails for some user CNs):
$ldapconn = ldap_connect("LDAP URL")
or die("Connection failed.");
ldap_bind($ldapconn, 'USERNAME', 'PASSWORD')
or die("Binding failed");
$ldapsearch = ldap_search($ldapconn, '', '(&(uniqueMember=CN=FIRSTNAME LASTNAME,O=COMPANY)(objectClass=groupOfNames))')
or die("Search failed: ".ldap_error($ldapconn));
The strange thing on this is that this code works for the most users, but for a few it does not.
So for example:
$ldapsearch = ldap_search($ldapconn, '', '(&(uniqueMember=CN=FIRSTNAME_1 LASTNAME_1,O=COMPANY)(objectClass=groupOfNames))')
-> works
$ldapsearch = ldap_search($ldapconn, '', '(&(uniqueMember=CN=FIRSTNAME_2 LASTNAME_2,O=COMPANY)(objectClass=groupOfNames))')
-> fails
But both CN definitly exists (in softerra ldap browser both search commands work, also in Lotus Notes both Users seem identical, only with some ldap clients and the php code it fails).
We also found the following statement from ibm on this page: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/apis/ldap_error_condt.htm
0x52 - Some local error occurred. This usually indicates that either the LDAP support (IBM® i option 32) is not installed on the system, or a malloc() operation has failed
Ldap support is installed and we have no idea where the memory allocation error could possibly be.
If you need any more information, please let me know.
Any help is appreciated
UPDATE:
We tried the search on CentOS with the cli and got the same local error (so its not a php ldap problem, more likely its a problem with the notes domino server):
ldapsearch -D "USERNAME" -w PASSWORD -h LDAP_URL -b "" -s sub "(&(uniqueMember=CN=FIRSTNAME LASTNAME,O=COMPANY)(objectClass=groupOfNames))"
-> ldap_result: Local error (-2)
The error occurs always for the same users. The user CNs where the problem appears are without special chars or similar and doesn't contain double first or surnames.