s4-repl: don't store repsFrom on DNs other than NC heads
authorAndrew Tridgell <tridge@samba.org>
Fri, 24 Sep 2010 02:48:03 +0000 (19:48 -0700)
committerAndrew Tridgell <tridge@samba.org>
Sat, 25 Sep 2010 17:38:45 +0000 (10:38 -0700)
we don't want a refsFrom on the Rid Manage$ DN

Pair-Programmed-With: Anatoliy Atanasov <anatoliy.atanasov@postpath.com>

source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 1712c03feb116f5996fdda62b2c7217e6e02156d..5fdcf9b1665efe8220501b82f1a864e391408bbd 100644 (file)
@@ -3305,6 +3305,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
        time_t t = time(NULL);
        NTTIME now;
        int ret;
+       uint32_t instanceType;
 
        ldb = ldb_module_get_ctx(ar->module);
        ruv = ar->objs->uptodateness_vector;
@@ -3315,6 +3316,13 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
 
        unix_to_nt_time(&now, t);
 
+       instanceType = ldb_msg_find_attr_as_uint(ar->search_msg, "instanceType", 0);
+       if (! (instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
+               DEBUG(4,(__location__ ": Skipping UDV and repsFrom update as not NC root: %s\n",
+                        ldb_dn_get_linearized(ar->search_msg->dn)));
+               return ldb_module_done(ar->req, NULL, NULL, LDB_SUCCESS);
+       }
+
        /*
         * first create the new replUpToDateVector
         */
@@ -3613,6 +3621,7 @@ static int replmd_replicated_uptodate_vector(struct replmd_replicated_request *a
        static const char *attrs[] = {
                "replUpToDateVector",
                "repsFrom",
+               "instanceType",
                NULL
        };
        struct ldb_request *search_req;