selftest: Print link meta-data when developer debugging is used
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 26 Sep 2017 22:21:48 +0000 (11:21 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 20 Oct 2017 06:01:35 +0000 (08:01 +0200)
For Windows, DRS is the only way to see the RMD_VERSION of a link, or to
tell what inactive links the DC. Add some debug to display this
information. By default, this debug is turned off.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Oct 20 08:01:35 CEST 2017 on sn-devel-144

source4/torture/drs/python/drs_base.py

index c2760e2cadf96609562ada9227d13ca5e2744ea5..10f2e63ae3b55c8a0d1544c82cc1b7d2f55678d0 100644 (file)
@@ -253,10 +253,22 @@ class DrsBaseTestCase(SambaToolCmdTest):
                 next_object = next_object.next_object
 
             print("Linked Attributes: %d" % ctr6.linked_attributes_count)
-            ctr6_links = self._get_ctr6_links(ctr6)
-            for link in ctr6_links:
+            for lidx in range(0, ctr6.linked_attributes_count):
+                l = ctr6.linked_attributes[lidx]
+                try:
+                    target = ndr_unpack(drsuapi.DsReplicaObjectIdentifier3,
+                                        l.value.blob)
+                except:
+                    target = ndr_unpack(drsuapi.DsReplicaObjectIdentifier3Binary,
+                                        l.value.blob)
+
                 print("Link Tgt %s... <-- Src %s"
-                      %(link.targetDN[:25], link.identifier))
+                      %(target.dn[:25], l.identifier.guid))
+               state = "Del"
+               if l.flags & drsuapi.DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE:
+                   state = "Act"
+               print("  v%u %s changed %u" %(l.meta_data.version, state,
+                     l.meta_data.originating_change_time))
 
             print("HWM:     %d" %(ctr6.new_highwatermark.highest_usn))
             print("Tmp HWM: %d" %(ctr6.new_highwatermark.tmp_highest_usn))