s4-dsdb: add the DSDB_CONTROL_PARTIAL_REPLICA when needed
authorAndrew Tridgell <tridge@samba.org>
Wed, 28 Sep 2011 04:35:27 +0000 (14:35 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 4 Oct 2011 04:08:57 +0000 (15:08 +1100)
when we are adding an object via DRS, we need to add the
DSDB_CONTROL_PARTIAL_REPLICA control if we are replicating a partial
replica, so ensure the partition module creates new NCs as partial
replicas

source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 13b87559c1d2bf8009ba8e887b516d0249bf396c..7a642426b48464cfdcd818c830360eb96db6ff4f 100644 (file)
@@ -3558,6 +3558,15 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
                                      false, NULL);
        if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
 
+       if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PARTIAL_REPLICA) {
+               /* this tells the partition module to make it a
+                  partial replica if creating an NC */
+               ret = ldb_request_add_control(change_req,
+                                             DSDB_CONTROL_PARTIAL_REPLICA,
+                                             false, NULL);
+               if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
+       }
+
        return ldb_next_request(ar->module, change_req);
 }