[python-ldap] Error with expiring accounts

Michael Ströder michael at stroeder.com
Tue Mar 4 22:23:01 CET 2014


Polkosnik, Adam wrote:
> I've not seen any mucking of any of those things, it goes something like this:
> 
>                import ldap, ldapurl
>                 try:
>                      ...
>                     l = ldap.initialize('ldap://myldapserver:1390')
>                     l.protocol_version = 3
>                     l.set_option(ldap.OPT_REFERRALS,0)
>                     l.set_option(ldap.OPT_TIMEOUT, app_timeout)
>                     ...
>                     logger.info("Logging in username: %s" % usern)
>                     l.simple_bind_s(usern, userp)
>                     ...
>                     return usern
>                 except ldap.INVALID_CREDENTIALS:
>                     logger.info("Invalid credentials: %s" % usern)
>                 except Exception, err:
>                     logger.info("LDAP Auth error: %s" % err)

You have to import ldap.controls.ppolicy and you need pyasn1 and
pyasn1_modules to be installed for that to work.

Ciao, Michael.

P.S.: Please subscribe to the really low-traffic mailing list so I don't have
to manually approve all your postings.

-------------- 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/20140304/5f12cbd1/attachment-0001.bin>


More information about the python-ldap mailing list