[python-ldap] Error with expiring accounts
adam.polkosnik at ny.frb.org
Wed Mar 12 21:46:52 CET 2014
In class PasswordExpiringControl:
self.gracePeriod = encodedControlValue
#self.gracePeriod = struct.unpack('!Q',encodedControlValue)
>>> l.simple_bind_s( un, password)
(97, , 1, [<ldap.controls.pwdpolicy.PasswordExpiringControl instance at 0x7f1ae5b1f098>])
It looks like 349853 is a tad above 4 days, so it should be the actual number of seconds until password expiration.
From: Michael Ströder [mailto:michael at stroeder.com]
Sent: Wednesday, March 12, 2014 4:21 PM
To: Polkosnik, Adam; python-ldap at python.org
Subject: Re: [python-ldap] Error with expiring accounts
Polkosnik, Adam wrote:
> I really don’t see where you have those values (they are listed in Lib/ldap/controls/pwdpolicy.py):
> 2.16.840.1.1137184.108.40.206 - Netscape Password Expired LDAPv3 control
> 2.16.840.1.1137220.127.116.11 - Netscape Password Expiring LDAPv3 control
Ouch! I've overlooked that you're talking about pwdpolicy and not ppolicy.
May I ask which LDAP server that is?
Actually the (ancient) I-D above specifies that the server returns this response control with criticality: false.
> Adding the missing imports to pwdpolicy.py makes it almost work:
> self.gracePeriod = struct.unpack('!Q',encodedControlValue)
> struct.error: unpack requires a string argument of length 8
> So, at this point it's complaining that the encodedControlValue is shorter than 8 bytes?!
> Dow we just get rid of the unpack and assign the value? At least that seemed to work ok.
Hmm, it seems I don't have such a LDAP server to test.
Could you please send repr(encodedControlValue) and determine how many seconds the grace period really is?
This e-mail message, including attachments, is for the sole use of the intended recipient(s) and may contain confidential or proprietary information. If you are not the intended recipient, immediately contact the sender by reply e-mail and destroy all copies of the original message.
More information about the python-ldap