join.py: Allow RODC to have push replication at join
authorGarming Sam <garming@catalyst.net.nz>
Tue, 28 Mar 2017 01:29:26 +0000 (14:29 +1300)
committerGarming Sam <garming@samba.org>
Thu, 13 Apr 2017 05:29:18 +0000 (07:29 +0200)
Normally DsAddEntry connects to DRSUAPI, however not in the RODC case. This meant that
it never called DsReplicaUpdateRefs and so never got push-replication after join.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/join.py

index 88b8d4b5e35669b8d963e9abb24bc3cedb92d703..6a924359407c41097f33ccf917c575a4c6005ad0 100644 (file)
@@ -964,8 +964,10 @@ class dc_join(object):
         if not ctx.RODC:
             r.options |= drsuapi.DRSUAPI_DRS_WRIT_REP
 
-        if ctx.drsuapi:
-            ctx.drsuapi.DsReplicaUpdateRefs(ctx.drsuapi_handle, 1, r)
+        if ctx.drsuapi is None:
+            ctx.drsuapi_connect()
+
+        ctx.drsuapi.DsReplicaUpdateRefs(ctx.drsuapi_handle, 1, r)
 
     def join_finalise(ctx):
         """Finalise the join, mark us synchronised and setup secrets db."""