Fix GET_TGT behaviour in DRS tests
authorTim Beale <>
Tue, 23 May 2017 02:37:56 +0000 (14:37 +1200)
committerGarming Sam <>
Mon, 18 Sep 2017 03:51:24 +0000 (05:51 +0200)
The existing code never passed the more_flags parameter into the
actual getNCChanges request, i.e. _getnc_req10(). This meant the
existing GET_TGT tests effectively did nothing.

Passing the flag through properly means we have to now change the tests
as the DNs returned by Windows now include any target objects in the
linked attributes. These tests now fail against Samba (because it
doesn't support GET_TGT yet).

Also added comments to the tests to help explain what they are actually

Note that Samba and Windows can return the objects in different orders,
due to significant differences in their underlying DB implementations
(Windows stores links in a separate DB, so sends links ordered strictly
by USN, whereas Samba sends links based on the USN of the source
object). To make the test a fair comparison between Windows and Samba,
we need to use dn_ordered=False.

Signed-off-by: Tim Beale <>
Reviewed-by: Andrew Bartlett <>
Reviewed-by: Garming Sam <>
selftest/knownfail.d/getnc_exop [new file with mode: 0644]

diff --git a/selftest/knownfail.d/getnc_exop b/selftest/knownfail.d/getnc_exop
new file mode 100644 (file)
index 0000000..0018b0b
--- /dev/null
@@ -0,0 +1,4 @@
+# This test fails because Samba doesn't support the GET_TGT option
index e79f076268cf3217c6afc9554c294db8b0ba9a39..57bb0545ea03d76c9196dd434bed91a4bfcf41dc 100644 (file)
@@ -279,7 +279,8 @@ class DrsBaseTestCase(SambaToolCmdTest):
-                                  replica_flags=replica_flags)
+                                  replica_flags=replica_flags,
+                                  more_flags=more_flags)
         req10.highwatermark = highwatermark
         if uptodateness_vector is not None:
             uptodateness_vector_v1 = drsuapi.DsReplicaCursorCtrEx()
index 37e5333e24560f4cbfc6a6b87b54da74e5271ade..b87404926f23852ae213bd564376b54cb06ff764 100644 (file)
@@ -434,11 +434,16 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
-        self._check_replication([dc3],
+        # GET_TGT seems to override DRS_CRITICAL_ONLY and also returns any
+        # object(s) that relate to the linked attributes (similar to GET_ANC)
+        self._check_replication([ou1, dc3],
-            expected_links=[dc3_managedBy_ou1])
+            expected_links=[dc3_managedBy_ou1], dn_ordered=False)
+        # Change DC3's managedBy to OU2 instead of OU1
+        # Note that the OU1 managedBy linked attribute will still exist as
+        # a tombstone object (and so will be returned in the replication still)
         m = ldb.Message()
         m.dn = ldb.Dn(self.ldb_dc1, dc3)
         m["managedBy"] = ldb.MessageElement(ou2, ldb.FLAG_MOD_REPLACE, "managedBy")
@@ -467,11 +472,16 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
-        self._check_replication([dc3],
+        # GET_TGT will also return any DNs referenced by the linked attributes
+        # (including the Tombstone attribute)
+        self._check_replication([ou1, ou2, dc3],
-            expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2])
+            expected_links=[dc3_managedBy_ou1,dc3_managedBy_ou2], dn_ordered=False)
+        # Use the highwater-mark prior to changing ManagedBy - this should
+        # only return the old/Tombstone and new linked attributes (we already
+        # know all the DNs)
@@ -500,6 +510,8 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase):
+        # Repeat the above set of tests using the uptodateness_vector
+        # instead of the highwater-mark