join.py: Fetch the remote DC NTDS GUID early
authorAndrew Bartlett <abartlet@samba.org>
Sun, 27 Mar 2016 04:29:35 +0000 (17:29 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 9 May 2016 23:43:14 +0000 (01:43 +0200)
This avoids touching the LDAP connection after the long replicate cycle, as it may
have timed out

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

index 83395f6023d2e6f269dbd7039f5f4aaa3b25c507..ebfd63ed265baf0d72be6d822108b94361848df9 100644 (file)
@@ -117,6 +117,9 @@ class dc_join(object):
             ctx.acct_dn = None
             ctx.myname = ctx.server.split('.')[0]
             ctx.ntds_guid = None
+
+            # Save this early
+            ctx.remote_dc_ntds_guid = ctx.samdb.get_ntds_GUID()
         else:
             # work out the DNs of all the objects we will be adding
             ctx.myname = netbios_name
@@ -929,7 +932,7 @@ class dc_join(object):
 
         # We want to appear to be the server we just cloned
         if ctx.clone_only:
-            guid = ctx.samdb.get_ntds_GUID()
+            guid = ctx.remote_dc_ntds_guid
         else:
             guid = ctx.ntds_guid