diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-01-31 09:50:47 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-02-09 09:30:22 +0100 |
commit | 0ae4e26f12a21ae7c0cc297d3d7f865a1726a0b9 (patch) | |
tree | 1199f1507f136b6eec3e2ed25accca97ac752f98 /python | |
parent | a3a17681831fdd7e666d92f95edaf3787a1fb405 (diff) | |
download | samba-0ae4e26f12a21ae7c0cc297d3d7f865a1726a0b9.tar.gz |
dbcheck: skip find_missing_forward_links_from_backlinks() if the db has the sortedLinks feature
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13228
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Feb 5 18:32:51 CET 2018 on sn-devel-144
(cherry picked from commit 0c3348feb09f4f0ba85455b8c3ff5c5fa60d139b)
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/dbchecker.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index c2c95a2e859..b2b8b0c9558 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -186,6 +186,23 @@ class dbcheck(object): else: self.rid_set_dn = None + self.compatibleFeatures = [] + self.requiredFeatures = [] + + try: + res = self.samdb.search(scope=ldb.SCOPE_BASE, + base="@SAMBA_DSDB", + attrs=["compatibleFeatures", + "requiredFeatures"]) + if "compatibleFeatures" in res[0]: + self.compatibleFeatures = res[0]["compatibleFeatures"] + if "requiredFeatures" in res[0]: + self.requiredFeatures = res[0]["requiredFeatures"] + except ldb.LdbError as (enum, estr): + if enum != ldb.ERR_NO_SUCH_OBJECT: + raise + pass + def check_database(self, DN=None, scope=ldb.SCOPE_SUBTREE, controls=[], attrs=['*']): '''perform a database check, returning the number of errors found''' res = self.samdb.search(base=DN, scope=scope, attrs=['dn'], controls=controls) @@ -745,6 +762,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) if self.do_modify(m, ["local_oid:1.3.6.1.4.1.7165.4.3.19.2:1"], "Failed to fix duplicate links in attribute '%s'" % forward_attr): self.report("Fixed duplicate links in attribute '%s'" % (forward_attr)) + duplicate_cache_key = "%s:%s" % (str(obj.dn), forward_attr) + assert duplicate_cache_key in self.duplicate_link_cache + self.duplicate_link_cache[duplicate_cache_key] = False def err_no_fsmoRoleOwner(self, obj): '''handle a missing fSMORoleOwner''' @@ -1011,6 +1031,11 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) forward_syntax) return (missing_forward_links, error_count) + if "sortedLinks" in self.compatibleFeatures: + self.report("Not checking for missing forward links because the db " + \ + "has the sortedLinks feature") + return (missing_forward_links, error_count) + try: obj_guid = obj['objectGUID'][0] obj_guid_str = str(ndr_unpack(misc.GUID, obj_guid)) |