From: Peter Palfrader Date: Thu, 10 Jan 2008 13:10:58 +0000 (+0100) Subject: Merge from alioth X-Git-Tag: userdir-ldap-0.3.16~19 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=1869ceb94928a76f23188d0b9939327c3a8dd7b9;hp=-c Merge from alioth merge r356 from alioth's userdir-ldap-common, and cherry pick that fix onto that: committer: Mark Hymers branch nick: userdir-ldap-common timestamp: Thu 2008-01-10 12:58:39 +0000 message: Fix mistake in ud-userimport add logic spotted by Peter Palfrader. --- 1869ceb94928a76f23188d0b9939327c3a8dd7b9 diff --combined debian/changelog index ab3ed40,382e859..ee25ccc --- a/debian/changelog +++ b/debian/changelog @@@ -1,5 -1,6 +1,6 @@@ userdir-ldap (0.3.15+xxx) XXunstable; urgency=low + [ Peter Palfrader ] * Ship userdir-ldap.schema with the package, add a note that it is now version-controlled in bzr on top of the file. * Get rid of debian/conffiles, wich only listed files in /etc anyway. @@@ -10,18 -11,13 +11,23 @@@ * Change the build dependency on python-support to be versioned >= 0.3. * ud-roleadd: Do not try to make role accounts of objectClass inetOrgPerson, that doesn't work. + * ud-fingerserv: implement daemonize() for non-inetd mode [sgran]. + * ud-useradd: support usergroups [HE]. + * ud-host/userdir-ldap.schema: Add 'purpose', 'physicalHost' to + debianServer schema and teach ud-host about [HE]. + * ud-host: cleanup: Replace local copy HBaseDn of the centrally + configured HostBaseDn [HE]. + * Add myself to uploaders. + * ud-generate: Set shadow expiry to 1 for locked accounts [mhy]. + * update doc/slapd-config.txt: labeledURL was removed from the schema but + not the slapd.conf example. Do that now [mhy]. - -- Peter Palfrader Wed, 26 Dec 2007 16:46:27 +0100 + [ Mark Hymers ] + * ud-userimport, ud-groupadd, ud-roleadd, ud-useradd, userdir_ldap.py: + Update ud-userimport to use the same objectClasses as + ud-{user,group,role}add and abstract them out into userdir_ldap.py + + -- Mark Hymers Wed, 26 Dec 2007 17:56:28 +0000 userdir-ldap (0.3.15) unstable; urgency=low diff --combined ud-userimport index 90a8de6,4a21daf..aa580fa --- a/ud-userimport +++ b/ud-userimport @@@ -90,37 -90,43 +90,43 @@@ def DoPasswd(l,Passwd) (Split[4],cn,mn,sn) = ParseGecos(Split[4]); CheckNumber(Split[2]); CheckNumber(Split[3]); - Rec = [(ldap.MOD_REPLACE,"uid",Split[0]), - (ldap.MOD_REPLACE,"uidNumber",Split[2]), - (ldap.MOD_REPLACE,"gidNumber",Split[3]), - (ldap.MOD_REPLACE,"gecos",Split[4]), - (ldap.MOD_REPLACE,"homeDirectory",Split[5]), - (ldap.MOD_REPLACE,"loginShell",Split[6]), - (ldap.MOD_REPLACE,"cn",cn), - (ldap.MOD_REPLACE,"mn",mn), - (ldap.MOD_REPLACE,"sn",sn)]; + Rec = [("uid",Split[0]), + ("uidNumber",Split[2]), + ("gidNumber",Split[3]), + ("gecos",Split[4]), + ("homeDirectory",Split[5]), + ("loginShell",Split[6]), + ("cn",cn), + ("sn",sn)]; + + # Avoid schema check complaints when mn is empty + if (mn): + Rec.append(("mn",mn)) Dn = "uid=" + Split[0] + "," + BaseDn; - print "Importing",Dn, + print "Importing", Dn sys.stdout.flush(); - # Unfortunately add_s does not take the same args as modify :| + DoModify = True + if (DoAdd == 1): try: - l.add_s(Dn,[("uid",Split[0]), - ("objectClass","top"), - ("objectClass","account"), - ("objectClass","posixAccount"), - ("objectClass","shadowAccount"), - ("objectClass","debiandeveloper")]); - AddRec = Rec - Rec.append(("objectClass", UserObjectClasses)) ++ AddRec = Rec[:] ++ AddRec.append(("objectClass", UserObjectClasses)) + l.add_s(Dn,AddRec) + DoModify = False + except ldap.ALREADY_EXISTS: print "exists",; - # Send the modify request - l.modify(Dn,Rec); - Outstanding = Outstanding + 1; - Outstanding = FlushOutstanding(l,Outstanding,1); - print "done"; + if (DoModify): + # Send the modify request + ModRec = [(ldap.MOD_REPLACE, k[0], k[1]) for k in Rec] + l.modify(Dn,ModRec); + Outstanding = Outstanding + 1; + Outstanding = FlushOutstanding(l,Outstanding,1); + print "done"; + FlushOutstanding(l,Outstanding); # Read the shadow file into the database @@@ -147,9 -153,15 +153,15 @@@ def DoShadow(l,Shadow) Rec = [(ldap.MOD_REPLACE,"shadowLastChange",Split[2]), (ldap.MOD_REPLACE,"shadowMin",Split[3]), (ldap.MOD_REPLACE,"shadowMax",Split[4]), - (ldap.MOD_REPLACE,"shadowWarning",Split[5]), - (ldap.MOD_REPLACE,"shadowInactive",Split[6]), - (ldap.MOD_REPLACE,"shadowExpire",Split[7])]; + (ldap.MOD_REPLACE,"shadowWarning",Split[5])] + + # Avoid schema violations + if (Split[6]): + Rec.append((ldap.MOD_REPLACE,"shadowInactive",Split[6])) + + if (Split[7]): + Rec.append((ldap.MOD_REPLACE,"shadowExpire",Split[7])) + if (WritePasses == 1): Rec.append((ldap.MOD_REPLACE,"userPassword","{crypt}"+Split[1])); @@@ -210,8 -222,7 +222,7 @@@ def DoGroup(l,Group) if (DoAdd == 1): try: l.add_s(Dn,[("gid",Split[0]), - ("objectClass","top"), - ("objectClass","posixGroup")]); + ("objectClass", GroupObjectClasses)]) except ldap.ALREADY_EXISTS: print "exists",;