X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-groupadd;h=4cb10eec7b1ea040ac0478f5768101c73506c25f;hb=30f27ec7d5ac5ba1dd4c47153b270aa5428067e4;hp=94b25e171a825573d7847552f61e4ef638b28d73;hpb=8195c17319860dc4c2bd5ac8d131cd53de404d7e;p=mirror%2Fuserdir-ldap.git diff --git a/ud-groupadd b/ud-groupadd index 94b25e1..4cb10ee 100755 --- a/ud-groupadd +++ b/ud-groupadd @@ -10,13 +10,15 @@ from userdir_gpg import *; # is to randomly guess uids until one is free. This uses the former. # Regrettably ldap doesn't have an integer attribute comparision function # so we can only cut the search down slightly + +# [JT] This is broken with Woody LDAP and the Schema; for now just +# search through all GIDs. def GetFreeID(l): - HighestUID = 1000; Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL, - "gidnumber>="+str(HighestUID),["gidnumber"]); + "gidNumber=*",["gidNumber"]); HighestUID = 0; for I in Attrs: - ID = int(GetAttr(I,"gidnumber","0")); + ID = int(GetAttr(I,"gidNumber","0")); if ID > HighestUID and ID < 60000: HighestUID = ID; return HighestUID + 1; @@ -42,7 +44,7 @@ UserDn = "uid=" + AdminUser + "," + BaseDn; l.simple_bind_s(UserDn,Password); while 1: - Group = raw_input("Group name?"); + Group = raw_input("Group name? "); if Group == "": sys.exit(1); @@ -59,6 +61,5 @@ Dn = "gid=" + Group + "," + BaseDn; print "Updating LDAP directory..", sys.stdout.flush(); l.add_s(Dn,[("gid",Group), - ("gidnumber",str(Id)), - ("objectclass","top"), - ("objectclass","posixGroup")]); + ("gidNumber",str(Id)), + ("objectClass",("top", "debianGroup"))]);