X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=3a9840bd301cb03beadd8751c43391d0b71dfce6;hb=af4fd674ca0c3db5bfaab34a0b852b09da6d4140;hp=c6484cbf4e596c8db394f52eac76631c371bec40;hpb=49421dc1e204eb958145a6287dd7c45461bafd79;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index c6484cb..3a9840b 100755 --- a/ud-generate +++ b/ud-generate @@ -147,11 +147,20 @@ def GenShadow(l,File): Pass = '*'; else: Pass = Pass[7:]; + + # If the account is locked, mark it as such in shadow + # See Debian Bug #308229 for why we set it to 1 instead of 0 + if (string.find(GetAttr(x,"userPassword"),"*LK*") != -1) \ + or GetAttr(x,"userPassword").startswith("!"): + ShadowExpire = '1' + else: + ShadowExpire = GetAttr(x,"shadowexpire") + Line = "%s:%s:%s:%s:%s:%s:%s:%s:" % (GetAttr(x,"uid"),\ Pass,GetAttr(x,"shadowLastChange"),\ GetAttr(x,"shadowMin"),GetAttr(x,"shadowMax"),\ GetAttr(x,"shadowWarning"),GetAttr(x,"shadowinactive"),\ - GetAttr(x,"shadowexpire")); + ShadowExpire); Line = Sanitize(Line) + "\n"; F.write("0%u %s" % (I,Line)); F.write(".%s %s" % (GetAttr(x,"uid"),Line));