Index: modules/univention/s4connector/s4/__init__.py =================================================================== --- modules/univention/s4connector/s4/__init__.py (Revision 56561) +++ modules/univention/s4connector/s4/__init__.py (Arbeitskopie) @@ -217,6 +217,11 @@ if object['attributes'].has_key(dn_attr): dn_attr_val=object['attributes'][dn_attr][0] + if dn_attr: ## this is set to 'cn' by calling functions for (ocs4 == u'computer') + ucs_rdn_attr = dn_attr + else: + ucs_rdn_attr = ucsattrib + def dn_premapped(object, dn_key, dn_mapping_stored): if (not dn_key in dn_mapping_stored) or (not object[dn_key]): ud.debug(ud.LDAP, ud.INFO, "samaccount_dn_mapping: not premapped (in first instance)") @@ -252,8 +257,11 @@ pos = string.find(dn,'=') pos2 = len(univention.s4connector.s4.explode_unicode_dn(dn)[0]) attrib = dn[:pos] - if ucsobject and object.get('attributes') and object['attributes'].get(ucsattrib): - value = object['attributes'][ucsattrib][0] + + if ucsobject and object.get('attributes') and object['attributes'].get(ucs_rdn_attr): + value = object['attributes'][ucs_rdn_attr][0] + if ocs4 == u'computer': ## equivalent to (dn_attr == 'cn') at the time of writing + value = "%s$" % value else: value = dn[pos+1:pos2]