drs_utils: HWM in 'samba-tool drs replicate --local' always zero
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 7 Jun 2017 04:56:18 +0000 (16:56 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 27 Jul 2017 22:25:15 +0000 (00:25 +0200)
The code to check for the 'repsFrom' highwatermark didn't have any
effect because the hwm variable was overwritten (initialized to all
zeroes) further down.

Using a zero HWM probably wouldn't have impacted functionality because
we were still correctly using the uptodatenessvector, which should
avoid a full replication.

This was introduced in commit e2ba17d26af42974e5d, presumably by
accident.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/drs_utils.py

index 1719af69aa64e323836b192b29c494eb487a0bd7..b9ed0597d4b01cc17257c33f81a278081e84f41d 100644 (file)
@@ -211,7 +211,13 @@ class drs_Replicate(object):
         req8.naming_context = drsuapi.DsReplicaObjectIdentifier()
         req8.naming_context.dn = dn
 
+        # Default to a full replication if we don't find an upToDatenessVector
         udv = None
+        hwm = drsuapi.DsReplicaHighWaterMark()
+        hwm.tmp_highest_usn = 0
+        hwm.reserved_usn = 0
+        hwm.highest_usn = 0
+
         if not full_sync:
             res = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE,
                                     attrs=["repsFrom"])
@@ -238,12 +244,6 @@ class drs_Replicate(object):
             udv.cursors = cursors_v1
             udv.count = len(cursors_v1)
 
-        # If we can't find an upToDateVector, or where told not to, replicate fully
-        hwm = drsuapi.DsReplicaHighWaterMark()
-        hwm.tmp_highest_usn = 0
-        hwm.reserved_usn = 0
-        hwm.highest_usn = 0
-
         req8.highwatermark = hwm
         req8.uptodateness_vector = udv