X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=blobdiff_plain;f=ud-info;fp=ud-info;h=7000ce9258394ee91c5fe3de611eafa9d693927f;hp=8cedd1d6014c3315a260f46169806fa5b0528a4b;hb=f27db3e7f5d3bb3fe0d36e1ab15e143ce45d269d;hpb=6bcb989fea7bf536788752c42b64f94d3b3d22d3 diff --git a/ud-info b/ud-info index 8cedd1d..7000ce9 100755 --- a/ud-info +++ b/ud-info @@ -375,8 +375,11 @@ while(1): print "Setting password.."; Pass = "{crypt}" + Pass; - l.modify_s(UserDn,[(ldap.MOD_REPLACE,"userPassword",Pass)]); + shadowLast = str(int(time.time()/24/60/60)); + l.modify_s(UserDn,[(ldap.MOD_REPLACE,"userPassword",Pass), + (ldap.MOD_REPLACE,"shadowLastChange",shadowLast)]); Attrs[0][1]["userPassword"] = [Pass]; + Attrs[0][1]["shadowLastChange"] = [shadowLast]; continue; # Randomize password @@ -396,8 +399,11 @@ while(1): print "Setting password.."; Pass = "{crypt}" + Pass; - l.modify_s(UserDn,[(ldap.MOD_REPLACE,"userPassword",Pass)]); + shadowLast = str(int(time.time()/24/60/60)); + l.modify_s(UserDn,[(ldap.MOD_REPLACE,"userPassword",Pass), + (ldap.MOD_REPLACE,"shadowLastChange",shadowLast)]); Attrs[0][1]["userPassword"] = [Pass]; + Attrs[0][1]["shadowLastChange"] = [shadowLast]; continue; # Lock account @@ -407,11 +413,14 @@ while(1): continue; print "Setting password.."; + shadowLast = str(int(time.time()/24/60/60)); l.modify_s(UserDn,[ (ldap.MOD_REPLACE,"userPassword","{crypt}*LK*"), - (ldap.MOD_REPLACE,"mailDisableMessage","account locked"), ]); + (ldap.MOD_REPLACE,"mailDisableMessage","account locked"), + (ldap.MOD_REPLACE,"shadowLastChange",shadowLast)]); Attrs[0][1]["userPassword"] = ["{crypt}*LK*"]; Attrs[0][1]["mailDisableMessage"] = ["account locked"]; + Attrs[0][1]["shadowLastChange"] = [shadowLast]; continue; # Handle changing an arbitary value