From: Marc 'HE' Brockschmidt Date: Wed, 26 Dec 2007 22:38:22 +0000 (+0100) Subject: Mark that no passwords are exported also in the generated passwd file, not X-Git-Tag: userdir-ldap-0.3.16~14^2^2~2 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=0681e6e93d9d21b85a67c4a4b81a9bd3dde848a5 Mark that no passwords are exported also in the generated passwd file, not only in the shadow file (by using a "*" as password (meaning "no password), instead of "x" (meaning "do I look like a passwd from the nineties? Look into /etc/shadow!")). --- diff --git a/ud-generate b/ud-generate index 3a9840b..55d05cf 100755 --- a/ud-generate +++ b/ud-generate @@ -88,7 +88,7 @@ def Done(File,F,Fdb): os.rename(File + ".tdb.tmp",File+".tdb"); # Generate the password list -def GenPasswd(l,File,HomePrefix): +def GenPasswd(l,File,HomePrefix,PwdMarker): F = None; try: F = open(File + ".tdb.tmp","w"); @@ -107,7 +107,8 @@ def GenPasswd(l,File,HomePrefix): if len(GetAttr(x,"gecos")) > 100 or len(GetAttr(x,"loginShell")) > 50: continue; - Line = "%s:x:%s:%s:%s:%s%s:%s" % (GetAttr(x,"uid"),\ + Line = "%s:%s:%s:%s:%s:%s%s:%s" % (GetAttr(x,"uid"),\ + PwdMarker,\ GetAttr(x,"uidNumber"),GetAttr(x,"gidNumber"),\ GetAttr(x,"gecos"),HomePrefix,GetAttr(x,"uid"),\ GetAttr(x,"loginShell")); @@ -852,7 +853,10 @@ while(1): DoLink(GlobalDir,OutDir,"disabled-accounts") sys.stdout.flush(); - GenPasswd(l,OutDir+"passwd",Split[1]); + if ExtraList.has_key("[NOPASSWD]"): + GenPasswd(l,OutDir+"passwd",Split[1], "*"); + else: + GenPasswd(l,OutDir+"passwd",Split[1], "x"); sys.stdout.flush(); GenGroup(l,OutDir+"group"); if ExtraList.has_key("[UNTRUSTED]"):