projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sigcheck: pycodestyle fixes
[mirror/userdir-ldap.git]
/
ud-useradd
diff --git
a/ud-useradd
b/ud-useradd
index
d6114ba
..
0dee8c4
100755
(executable)
--- a/
ud-useradd
+++ b/
ud-useradd
@@
-51,7
+51,7
@@
def ShouldIgnoreID(uid):
# search through all UIDs.
def GetFreeID(l):
Attrs = l.search_s(BaseBaseDn,ldap.SCOPE_SUBTREE,
# search through all UIDs.
def GetFreeID(l):
Attrs = l.search_s(BaseBaseDn,ldap.SCOPE_SUBTREE,
- "
uidNumber=*
",["uidNumber", "gidNumber", "uid"]);
+ "
(|(uidNumber=*)(gidNumber=*))
",["uidNumber", "gidNumber", "uid"]);
HighestUID = 0;
gids = [];
uids = [];
HighestUID = 0;
gids = [];
uids = [];
@@
-180,7
+180,7
@@
while 1:
cn = GetAttr(Attrs[0],"cn");
sn = GetAttr(Attrs[0],"sn");
mn = GetAttr(Attrs[0],"mn");
cn = GetAttr(Attrs[0],"cn");
sn = GetAttr(Attrs[0],"sn");
mn = GetAttr(Attrs[0],"mn");
- if privsub
==
None or privsub == "":
+ if privsub
is
None or privsub == "":
privsub = " ";
break;
else:
privsub = " ";
break;
else:
@@
-249,7
+249,7
@@
if GuestAccount:
shadowExpire = int(time.time() / 3600 / 24) + exp
res = raw_input("Hosts to grant access to: ")
for h in res.split():
shadowExpire = int(time.time() / 3600 / 24) + exp
res = raw_input("Hosts to grant access to: ")
for h in res.split():
- if
not '.'
in h: h = h + '.' + HostDomain
+ if
'.' not
in h: h = h + '.' + HostDomain
if exp > 0: h = h + " " + datetime.datetime.fromtimestamp( time.time() + exp * 24*3600 ).strftime("%Y%m%d")
hostacl.append(h)
if exp > 0: h = h + " " + datetime.datetime.fromtimestamp( time.time() + exp * 24*3600 ).strftime("%Y%m%d")
hostacl.append(h)
@@
-267,8
+267,8
@@
if Update == 0 or ForceMail == 1:
CryptedPass = GPGEncrypt("Your new password is '" + Password + "'\n",\
"0x"+Keys[0][1],UsePGP2);
Password = None;
CryptedPass = GPGEncrypt("Your new password is '" + Password + "'\n",\
"0x"+Keys[0][1],UsePGP2);
Password = None;
- if CryptedPass
==
None:
- raise
"Error","Password Encryption failed"
+ if CryptedPass
is
None:
+ raise
Exception("Password Encryption failed")
else:
Pass = HashPass(Password);
CryptedPass = "Your password has been set to the previously agreed value.";
else:
Pass = HashPass(Password);
CryptedPass = "Your password has been set to the previously agreed value.";
@@
-376,7
+376,7
@@
else:
(ldap.MOD_REPLACE,"shadowExpire","")];
if privsub != " ":
Rec.append((ldap.MOD_REPLACE,"privateSub",privsub));
(ldap.MOD_REPLACE,"shadowExpire","")];
if privsub != " ":
Rec.append((ldap.MOD_REPLACE,"privateSub",privsub));
- if Pass
!=
None:
+ if Pass
is not
None:
Rec.append((ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass));
# Do it
l.modify_s(Dn,Rec);
Rec.append((ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass));
# Do it
l.modify_s(Dn,Rec);
@@
-397,8
+397,8
@@
Reply = TemplateSubst(Subst,open(templatepath, "r").read())
Child = os.popen("/usr/sbin/sendmail -t","w");
#Child = os.popen("cat","w");
Child.write(Reply);
Child = os.popen("/usr/sbin/sendmail -t","w");
#Child = os.popen("cat","w");
Child.write(Reply);
-if Child.close()
!=
None:
- raise E
rror, "Sendmail gave a non-zero return code";
+if Child.close()
is not
None:
+ raise E
xception("Sendmail gave a non-zero return code")
# vim:set et:
# vim:set ts=3:
# vim:set et:
# vim:set ts=3: