[python-ldap] How to use the PasswordPolicy Control
michael at stroeder.com
Fri Nov 4 18:07:49 CET 2011
> How to use the PasswordPolicy Control
> When I provide a PasswordPolicyControl during a bind(), I fail to
> understand how to read the PasswordPolicy response.
IMO this code is not usable yet. Further work is needed in this area. The main
problem is that in case of an error an exception is raised by python-ldap and
the response control is not tied to the exception. I'm not sure the response
control is even extracted from the LDAP PDU.
> l.set_option(ldap.OPT_SERVER_CONTROLS, [pwctrl])
This is not needed (and I somewhat doubt it works).
> msgid = l.simple_bind_s(binddn, bindpw, serverctrls=[pwctrl])
> except ldap.LDAPError as e:
> print 'exc:', sys.exc_info()
> r = l.get_option(ldap.OPT_SERVER_CONTROLS)
I doubt that's really usable especially since it's not thread-safe.
More information about the python-ldap