[python-ldap] Help for get exception

Michael Ströder michael at stroeder.com
Wed Nov 27 19:39:29 CET 2013


Avner Gonçalves wrote:
> I run this command in line for terminar:
> "ldapwhoami -x -D "cn=XXXXXX,ou=People,dc=XXXXXX,dc=com" -e ppolicy -w XXXXXX"
> 
> Return:
> "ldap_bind: Invalid credentials (49); Password expired"
> 
> I need run this code:
> 
> try:
>     l = ldap.open("127.0.0.1")
>     l.protocol_version = ldap.VERSION3
> 
>     username  = "cn=XXXXXX,ou=People,dc=XXXXXX,dc=com"
>     password  = "XXXXXX"
> 
>     msgid = l.simple_bind_s(username,password)
>     print msgid;
> 
> except ldap.LDAPError, e:
>     print 'Simple bind failed:',str(e)
>     sys.exit(1)
> 
> And return:
> "Simple bind failed: {'desc': 'Invalid credentials'}"
> 
> 
> How i get this execption "Password expired" ?

See Demo/pyasn1/ppolicy.py in python-ldap's source distribution tar.gz.

Ciao, Michael.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2398 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20131127/d2e9be66/attachment.bin>


More information about the python-ldap mailing list