搜索LDAP时出错

2024-10-01 11:24:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行一个python脚本来连接和绑定到LDAP,但是在搜索LDAP时它抛出了这个错误。 使用此函数:search_s()

但是错误: {'info': '00002024: LdapErr: DSID-0C060595, comment: No other operations may be performed on the connection while a bind is outstanding., data 0, v1772', 'desc': 'Server is busy'}

请帮忙。我该怎么做才能解决这个问题?在

提前谢谢。在


Tags: 函数noinfo脚本searchis错误comment
1条回答
网友
1楼 · 发布于 2024-10-01 11:24:20

好的,发送一个绑定到LDAP,然后发送一个搜索。问题是,在服务器处理第一个请求之前,您发送了第二个请求,它会恼怒您,从而得到“我很忙”的响应。在

解决方案是告诉Python ldap客户机在继续之前等待结果,因此:

l = ldap.initialize('ldap://fnord.com')
l.bind('thisismyname', 'andthisismyquest')
l.search_s(scope, ldap.SCOPE_SUBTREE, query, attributes)

变成这样:

^{pr2}$

当我对我的脚本做了这样的修改后,它每次都能可靠地工作。在

更新:

我找到了正确的方法:

l = ldap.initialize('ldap://fnord.com')
l.bind_s('thisismyname', 'andthisismyquest') # S IS FOR SYNCHRONOUS, IS GOOD ENOUGH FOR ME
l.search_s(scope, ldap.SCOPE_SUBTREE, query, attributes)

相关问题 更多 >