diff --git a/services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py b/services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py index 83db5dd..9084615 100644 --- a/services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py +++ b/services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py @@ -353,12 +353,14 @@ def samaccountname_dn_mapping(s4connector, given_object, dn_mapping_stored, ucso newdn = unicode(result[0][0], 'utf8') else: s4_rdn = ldap.dn.str2dn(result[0][0])[0] - new_s4_dn = unicode(ldap.dn.dn2str([s4_rdn] + exploded_dn[1:]), 'utf8') - pos = new_s4_dn.lower().rfind(s4connector.lo_s4.base.lower()) - newdn = new_s4_dn[:pos] + s4connector.lo.base + tmp_dn_string = unicode(ldap.dn.dn2str([s4_rdn] + exploded_dn[1:]), 'utf8') + pos = tmp_dn_string.lower().rfind(s4connector.lo.base.lower()) + newdn = tmp_dn_string[:pos] + s4connector.lo_s4.base else: newdn_rdn = [('cn', fst_rdn_value_utf8, ldap.AVA_STRING)] - newdn = unicode(ldap.dn.dn2str([newdn_rdn] + exploded_dn[1:]), 'utf8') # new object, don't need to change + tmp_dn_string = unicode(ldap.dn.dn2str([newdn_rdn] + exploded_dn[1:]), 'utf8') # new object, don't need to change + pos = tmp_dn_string.lower().rfind(s4connector.lo.base.lower()) + newdn = tmp_dn_string[:pos] + s4connector.lo_s4.base ud.debug(ud.LDAP, ud.INFO, "samaccount_dn_mapping: newdn: %s" % newdn) else: # get the object to read the sAMAccountName in S4 and use it as name @@ -2453,8 +2455,7 @@ class s4(univention.s4connector.ucs): old_dn = tmp_object['dn'] if hasattr(self.property[property_type], 'position_mapping'): for mapping in self.property[property_type].position_mapping: - old_dn = self._subtree_replace(old_dn.lower(), mapping[1].lower(), mapping[0].lower()) - old_dn = self._subtree_replace(old_dn, self.lo.base, self.lo_s4.base) + old_dn = self._subtree_replace(old_dn.lower(), mapping[0].lower(), mapping[1].lower()) # the old object was moved in UCS, but does this object exist in S4? try: old_object = self.lo_s4.lo.search_ext_s(compatible_modstring(old_dn), ldap.SCOPE_BASE, 'objectClass=*', timeout=-1, sizelimit=0) diff --git a/test/ucs-ec2-tools b/test/ucs-ec2-tools index 755b752..bc0b7f6 160000 --- a/test/ucs-ec2-tools +++ b/test/ucs-ec2-tools @@ -1 +1 @@ -Subproject commit 755b752d461b62ba29666294762e04f00ea9a74f +Subproject commit bc0b7f6b1dfba8ec6dddbe50fa217fafe14ce4c8