From: Ralph Boehme Date: Thu, 25 Jan 2018 09:34:29 +0000 (+0100) Subject: dbcheck: add a dict where we remember attributes with duplicate links X-Git-Tag: tevent-0.9.36~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4cc062fa98f65369f3bde24a987c2651632cb06;p=thirdparty%2Fsamba.git dbcheck: add a dict where we remember attributes with duplicate links BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228 Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Ralph Boehme Signed-off-by: Stefan Metzmacher --- diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index 9185a1d1bed..787cea2de48 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -65,6 +65,7 @@ class dbcheck(object): self.fix_undead_linked_attributes = False self.fix_all_missing_backlinks = False self.fix_all_orphaned_backlinks = False + self.duplicate_link_cache = dict() self.recover_all_forward_links = False self.fix_rmd_flags = False self.fix_ntsecuritydescriptor = False @@ -904,6 +905,10 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) if backlink_attr is None: return (error_count, duplicate_dict, unique_dict) + duplicate_cache_key = "%s:%s" % (str(obj.dn), forward_attr) + if duplicate_cache_key not in self.duplicate_link_cache: + self.duplicate_link_cache[duplicate_cache_key] = False + for val in obj[forward_attr]: dsdb_dn = dsdb_Dn(self.samdb, val, forward_syntax) @@ -945,6 +950,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) duplicate_dict[keystr]["delete"].append(unique_dict[keystr]) unique_dict[keystr] = dsdb_dn + if error_count != 0: + self.duplicate_link_cache[duplicate_cache_key] = True return (error_count, duplicate_dict, unique_dict)