diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py index 3030134..0d140fb 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py @@ -937,7 +937,7 @@ def _move(self, newdn, modify_childs=1, ignore_license=0): raise def _remove(self, remove_childs=0): - univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'handlers/__init__._remove() called for %s' % self.dn) + univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'handlers/__init__._remove() called for %r with remove_childs=%r' % (self.dn, remove_childs)) self.exceptions = [] if _prevent_to_change_ad_properties and self._is_synced_object(): @@ -947,8 +947,10 @@ def _remove(self, remove_childs=0): self.call_udm_property_hook('hook_ldap_pre_remove', self) if remove_childs: - univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'handlers/__init__._remove() children of base dn %s' % self.dn) - subelements = self.lo.search(base=self.dn, scope='one', attr=[]) + subelements = [] + if 'FALSE' not in self.lo.getAttr(self.dn, 'hasSubordinates'): + univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'handlers/__init__._remove() children of base dn %s' % (self.dn,)) + subelements = self.lo.search(base=self.dn, scope='one', attr=[]) if subelements: try: for subolddn, suboldattrs in subelements: