gpt4 book ai didi

python - LDAP:ldap.SIZELIMIT_EXCEEDED

转载 作者:太空狗 更新时间:2023-10-29 20:55:03 27 4
gpt4 key购买 nike

当我运行这段代码时,我收到一个 ldap.SIZELIMIT_EXCEEDED 错误:

import ldap

url = 'ldap://<domain>:389'
binddn = 'cn=<username> readonly,cn=users,dc=tnc,dc=org'
password = '<password>'

conn = ldap.initialize(url)
conn.simple_bind_s(binddn,password)

base_dn = "ou=People,dc=tnc,dc=org"
filter = '(objectClass=*)'
attrs = ['sn']

conn.search_s( base_dn, ldap.SCOPE_SUBTREE, filter, attrs )

username 是我的实际用户名,password 是我的实际密码,domain 是实际域。

我不明白为什么会这样。有人可以解释一下吗?

最佳答案

手册:http://www.python-ldap.org/doc/html/ldap.html

exception ldap.SIZELIMIT_EXCEEDED
An LDAP size limit was exceeded. This could be due to a sizelimit configuration on the LDAP server.

我认为您最好的选择是限制您从服务器收到的消息的 sizelimit。您可以通过设置属性 LDAPObject.sizelimit(已弃用)或在使用 search_ext()

时使用 sizelimit 参数来实现

你还应该确保你的绑定(bind)真的成功了......

关于python - LDAP:ldap.SIZELIMIT_EXCEEDED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3378142/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com