X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-useradd;h=6c2e19d4f43286566b79793b6067a4c1d0ab6f53;hb=95a2edcec85a3ee7fbe7eb3829948238b235e998;hp=cdaf3f8bdc839b06b3e7189198a3182817a83812;hpb=45ac1f545f858c2d538b8e9bdb6532a1a0061286;p=mirror%2Fuserdir-ldap.git diff --git a/ud-useradd b/ud-useradd index cdaf3f8..6c2e19d 100755 --- a/ud-useradd +++ b/ud-useradd @@ -89,6 +89,11 @@ while len(Keys[0][1]) < 40: if Res == "": break; +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"); + # Try to get a uniq account name Update=0 while 1: @@ -150,7 +155,6 @@ if Update == 0 or ForceMail == 1: print "Randomizing and encrypting password" Password = GenPass(); Pass = HashPass(Password); - print "PASS: ", Password; # Use GPG to encrypt it, pass the fingerprint to ID it CryptedPass = GPGEncrypt("Your new password is '" + Password + "'\n",\ @@ -192,7 +196,7 @@ Subst["__LOGIN__"] = account; Subst["__PRIVATE__"] = privsub; Subst["__EMAIL__"] = email; Subst["__PASSWORD__"] = CryptedPass; -Subst["__LISTPASS__"] = string.strip(open(pwd.getpwuid(os.getuid())[5]+"/.debian-lists_passwd","r").read()); +#Subst["__LISTPASS__"] = string.strip(open(pwd.getpwuid(os.getuid())[5]+"/.debian-lists_passwd","r").read()); # Generate the LDAP request Rec = [(ldap.MOD_REPLACE,"uid",account),