duankezong4064 2018-06-12 14:53
浏览 109

ldap搜索的奇怪行为(本地错误)

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 一直显示正在等待HID—ISP