[英]Connecting python to ldap server using python-ldap: getting 'desc': 'Invalid credentials' though username and password are valid
My code: 我的代码:
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
But I get the following error: 但是我收到以下错误:
{'info': '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece', 'desc': 'Invalid credentials'}
eventhough I give valid username and password. 虽然我提供有效的用户名和密码。
Note: Iam using Linux system and ldap server is in windows os 注意:Iam使用Linux系统和ldap服务器是在windows os中
I got the solution. 我得到了解决方案。
conn.protocol_version = ldap.VERSION3
conn.set_option(ldap.OPT_REFERRALS, 0)
i have added these two lines before the bind takes place 我在绑定发生之前添加了这两行
and it worked... 它起作用了......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.