s4-repl: load RODC partitions using msDS-hasFullReplicaNCs
authorAndrew Tridgell <tridge@samba.org>
Wed, 25 Aug 2010 02:32:48 +0000 (12:32 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 25 Aug 2010 13:05:05 +0000 (23:05 +1000)
we mark these as incoming_only

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/repl/drepl_partitions.c
source4/dsdb/repl/drepl_service.h

index cb45b41248fbd0dd1cb1ce86db1aad4213ad0659..5a11dce50f7d0073c2da647ce522d1e98c6163a8 100644 (file)
@@ -39,7 +39,7 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
        struct ldb_dn *basedn;
        struct ldb_result *r;
        struct ldb_message_element *el;
-       static const char *attrs[] = { "hasMasterNCs", NULL };
+       static const char *attrs[] = { "hasMasterNCs", "msDS-hasFullReplicaNCs", NULL };
        unsigned int i;
        int ret;
 
@@ -55,10 +55,9 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
                return WERR_FOOBAR;
        }
 
+
+
        el = ldb_msg_find_element(r->msgs[0], "hasMasterNCs");
-       if (!el) {
-               return WERR_FOOBAR;
-       }
 
        for (i=0; el && i < el->num_values; i++) {
                const char *v = (const char *)el->values[i].data;
@@ -80,6 +79,29 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
                DEBUG(2, ("dreplsrv_partition[%s] loaded\n", v));
        }
 
+       el = ldb_msg_find_element(r->msgs[0], "msDS-hasFullReplicaNCs");
+
+       for (i=0; el && i < el->num_values; i++) {
+               const char *v = (const char *)el->values[i].data;
+               struct ldb_dn *pdn;
+               struct dreplsrv_partition *p;
+
+               pdn = ldb_dn_new(s, s->samdb, v);
+               if (!ldb_dn_validate(pdn)) {
+                       return WERR_FOOBAR;
+               }
+
+               p = talloc_zero(s, struct dreplsrv_partition);
+               W_ERROR_HAVE_NO_MEMORY(p);
+
+               p->dn = talloc_steal(p, pdn);
+               p->incoming_only = true;
+
+               DLIST_ADD(s->partitions, p);
+
+               DEBUG(2, ("dreplsrv_partition[%s] loaded (incoming only)\n", v));
+       }
+
        talloc_free(r);
 
        status = dreplsrv_refresh_partitions(s);
index eefd4da7f4ee1a8cfd99c1ed4ce6cff16df144b0..4019bf730700778071115d78e573c7029a3ef59f 100644 (file)
@@ -99,6 +99,8 @@ struct dreplsrv_partition {
         * a linked list of all source dsa's we replicate from
         */
        struct dreplsrv_partition_source_dsa *sources;
+
+       bool incoming_only;
 };
 
 typedef void (*dreplsrv_fsmo_callback_t)(struct dreplsrv_service *,