X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-useradd;h=415b58026d0f31fbd845d6f9fa837a0a68fabf4f;hb=0615d76c2c3cc5c334ca528248551e8771d52b46;hp=89ee2abb69c0b349d876eb30c12997a26af52cef;hpb=c7a956b94f883078b47dc601f6b099a0169d4c1c;p=mirror%2Fuserdir-ldap.git diff --git a/ud-useradd b/ud-useradd index 89ee2ab..415b580 100755 --- a/ud-useradd +++ b/ud-useradd @@ -119,17 +119,19 @@ while len(Keys[0][1]) < 40: if Res == "": break; +Update = 0 Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"keyFingerPrint=" + Keys[0][1]); if len(Attrs) != 0: print "*** This key already belongs to",GetAttr(Attrs[0],"uid"); account = GetAttr(Attrs[0],"uid"); + Update = 1 # Try to get a uniq account name -Update=0 while 1: - Res = raw_input("Login account [" + account + "]? "); - if Res != "": - account = Res; + if Update == 0: + Res = raw_input("Login account [" + account + "]? "); + if Res != "": + account = Res; Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=" + account); if len(Attrs) == 0: privsub = "%s@debian.org"%(account); @@ -148,6 +150,8 @@ while 1: if privsub == None or privsub == "": privsub = " "; break; + else: + sys.exit(1) # Prompt for the first/last name and email address Res = raw_input("First name [" + cn + "]? "); @@ -249,10 +253,11 @@ if Update == 0: ("shadowMin","0"), ("shadowMax","99999"), ("shadowWarning","7"), - ("privateSub",privsub), ("userPassword","{crypt}"+Pass)]; if mn: Details.append(("mn",mn)); + if privsub != " ": + Details.append(("privateSub",privsub)) l.add_s(Dn,Details); else: # Modification