samba-tool drs: Ensure we do not replicate all secrets to an RODC, even with --local
authorAndrew Bartlett <abartlet@samba.org>
Fri, 20 Feb 2015 04:54:32 +0000 (17:54 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 16 Mar 2015 02:00:07 +0000 (03:00 +0100)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
python/samba/netcmd/drs.py

index 36dc48e2c234ed5301457172e216e125624f2d21..e8e9ec879aac1f6c016a7809fa48d42fd3ac856d 100644 (file)
@@ -265,8 +265,11 @@ def drs_local_replicate(self, SOURCE_DC, NC):
     repl = drs_utils.drs_Replicate("ncacn_ip_tcp:%s[seal]" % self.server, self.lp,
                                    self.creds, self.local_samdb, dest_dsa_invocation_id)
 
+    # Work out if we are an RODC, so that a forced local replicate
+    # with the admin pw does not sync passwords
+    rodc = self.local_samdb.am_rodc()
     try:
-        repl.replicate(NC, source_dsa_invocation_id, destination_dsa_guid)
+        repl.replicate(NC, source_dsa_invocation_id, destination_dsa_guid, rodc=rodc)
     except Exception, e:
         raise CommandError("Error replicating DN %s" % NC, e)
     self.samdb.transaction_commit()