我的代码:
l=ldap.initialize('ldap://x.x.x.x:389')
username = "myusername"
user_dn = "uid="+username+", dc=ananthtech,dc=com"
password = "mypassword"
try:
l.simple_bind_s(username, password)
valid = True
except Exception, error:
print error
但是我得到以下错误:
{'info': '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece', 'desc': 'Invalid credentials'}
尽管我提供了有效的用户名和密码。
注意:我使用的是linux系统,ldap server在windows os下
最佳答案
我得到了解决方案。
conn.protocol_version = ldap.VERSION3
conn.set_option(ldap.OPT_REFERRALS, 0)
我在绑定(bind)发生之前添加了这两行
成功了...
关于python - 使用 python-ldap : getting 'desc' : 'Invalid credentials' though username and password are valid 将 python 连接到 ldap 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23426739/