dbchecker: Stop ignoring linked cases where both objects are alive
authorGarming Sam <garming@catalyst.net.nz>
Wed, 22 Feb 2017 02:42:46 +0000 (15:42 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 23 Feb 2017 22:58:21 +0000 (23:58 +0100)
Previously, this did nothing and the code was both untested and unused.

Removes the knownfail entry for dbcheck.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12600

python/samba/dbchecker.py
selftest/knownfail

index 22819dedcdf658fce7a966e3e8a59bccaa42d6c8..032c0e73bbdb3045c3a551f248ad0cf91ae91639 100644 (file)
@@ -645,10 +645,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("Not fixing missing backlink %s" % backlink_name)
             return
         m = ldb.Message()
-        m.dn = obj.dn
-        m['old_value'] = ldb.MessageElement(val, ldb.FLAG_MOD_DELETE, attrname)
-        m['new_value'] = ldb.MessageElement(val, ldb.FLAG_MOD_ADD, attrname)
-        if self.do_modify(m, ["show_recycled:1"],
+        m.dn = target_dn
+        m['new_value'] = ldb.MessageElement(val, ldb.FLAG_MOD_ADD, backlink_name)
+        if self.do_modify(m, ["show_recycled:1", "relax:0"],
                           "Failed to fix missing backlink %s" % backlink_name):
             self.report("Fixed missing backlink %s" % (backlink_name))
 
@@ -974,12 +973,16 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                         if v_guid == obj_guid:
                             match_count += 1
                 if match_count != 1:
-                    if target_is_deleted:
-                        error_count += 1
-                        if linkID & 1:
-                            self.err_missing_backlink(obj, attrname, val, reverse_link_name, dsdb_dn.dn)
-                        else:
-                            self.err_orphaned_backlink(obj, attrname, val, reverse_link_name, dsdb_dn.dn)
+                    error_count += 1
+                    if linkID & 1:
+                        # Backlink exists, but forward link does not
+                        # Delete the hanging backlink
+                        self.err_orphaned_backlink(obj, attrname, val, reverse_link_name, dsdb_dn.dn)
+                    else:
+                        # Forward link exists, but backlink does not
+                        # Add the missing backlink (if the target object is not Deleted Objects?)
+                        if not target_is_deleted:
+                            self.err_missing_backlink(obj, attrname, obj.dn.extended_str(), reverse_link_name, dsdb_dn.dn)
                     continue
 
 
index 38e91dd6ebdfb988f426dad4755aa82fcfcd5c23..d96e238796c34521e60fb3b386f5ae0f6175f5ec 100644 (file)
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_add_duplicate_different_type.*
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_rank_none.*
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_security_descriptor.*
-^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck\(none\).*