X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=blobdiff_plain;f=ud-userimport;h=db81b65791502ae8eb62b7aa8e746ff5dad902b6;hp=3e926ecf197563997bc532093fd5d04b29c331c4;hb=HEAD;hpb=198bda079d03f7251b50f95e6a28c1fb046e616a diff --git a/ud-userimport b/ud-userimport index 3e926ec..db81b65 100755 --- a/ud-userimport +++ b/ud-userimport @@ -83,8 +83,10 @@ def DoPasswd(l,Passwd): Split = re.split("[:\n]",Line); (Split[4],cn,mn,sn) = ParseGecos(Split[4]); - Split[2] = int(Split[2]) - Split[3] = int(Split[3]) + # This just tests whether these are integers and throws an + # exception if not + int(Split[2]) + int(Split[3]) Rec = [("uid",Split[0]), ("uidNumber",Split[2]), ("gidNumber",Split[3]), @@ -106,8 +108,8 @@ def DoPasswd(l,Passwd): if (DoAdd == 1): try: - AddRec = Rec - Rec.append(("objectClass", UserObjectClasses)) + AddRec = Rec[:] + AddRec.append(("objectClass", UserObjectClasses)) l.add_s(Dn,AddRec) DoModify = False @@ -143,7 +145,7 @@ def DoShadow(l,Shadow): continue; for x in range(2,8): - Split[x] = int(Split[x]) + int(Split[x]) Rec = [(ldap.MOD_REPLACE,"shadowLastChange",Split[2]), (ldap.MOD_REPLACE,"shadowMin",Split[3]), @@ -184,7 +186,7 @@ def DoGroup(l,Group): # Split up the group information Split = re.split("[:\n]",Line); Members = re.split("[, ]*",Split[3]); - Split[2] = int(Split[2]) + int(Split[2]) # Iterate over the membership list and add the membership information # To the directory @@ -247,7 +249,7 @@ for (switch, val) in options: # Main program starts here # Connect to the ldap server -l = passwdAccessLDAP(LDAPServer, BaseDn, AdminUser) +l = passwdAccessLDAP(BaseDn, AdminUser) if (Passwd != ""): DoPasswd(l,Passwd);