Hi everyone,
Here is a sample code that works the first time I run the loop and fails the
second time with the following error. can someone let me know if the
credentials are cached by the library or what could be wrong? Any help is
greatly appreciated.
ldap.INVALID_CREDENTIALS: {'info': '80090308: LdapErr: DSID-0C09043E, comment:
AcceptSecurityContext error, data 57, vece', 'desc': 'Invalid credentials'}
import ldap, ldap.sasl
def main():
while True:
ldapServer="lserver"
base ="ou=users,ou=accounts,dc=example,dc=com"
user="user"
passwd="pass"
l = ldap.initialize(ldapServer)
l.set_option(ldap.OPT_REFERRALS, 0)
try:
tok = ldap.sasl.digest_md5(user, passwd)
l.sasl_interactive_bind_s("",tok)
except ldap.INVALID_CREDENTIALS, e :
print "Invalid Username or Password"
print e
return False
print "success"
l.unbind()
if __name__=="__main__":
print "here"
main()
|