[python-ldap] Can't get a more specific exception when binding to LDAP server

Michael Ströder michael at stroeder.com
Fri Oct 26 19:26:13 CEST 2012


Mihai Tabara wrote:
> I am struggling finding a way to get a more particular exception than
> 'Invalid_credentials(49)' when a binding to LDAP server cannot be established.
> I am pretty sure it is a common issue but my previous search didn't get me too
> far. Please accept my apologies if spamming with my question.
> 
> So, let's assume my account on LDAP server has just been deactivated due to
> password aging, and therefore, password expiration.
> 
> Trying to reach my account within a "ldapwhoami" call from ldap-utils Unix
> tools goes naturally and returns awaited response.
> 
> ===
> root at debian:~# ldapwhoami -e ppolicy -x -D
> "uid=mihait,ou=Users,dc=example,dc=com" -w secret
> ldap_bind: Invalid credentials (49); Password expired

Using -e ppolicy with OpenLDAP command-line tool sends the password policy
control along with the (simple) bind request.

Check out Demo/pyasn1/ppolicy.py in recent python-ldap source distribution to
learn how to do that with python-ldap 2.4.6+.

Ciao, Michael.

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


More information about the python-ldap mailing list