# 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 = [];
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:
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)
CryptedPass = GPGEncrypt("Your new password is '" + Password + "'\n",\
"0x"+Keys[0][1],UsePGP2);
Password = None;
- if CryptedPass == None:
+ if CryptedPass is None:
raise "Error","Password Encryption failed"
else:
Pass = HashPass(Password);