diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-08-25 12:32:48 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-08-25 23:05:05 +1000 |
commit | cb0f8f0ee087475e63bcc969cf501ce9eae9c98f (patch) | |
tree | a450836c4711c7201b56749d4984197b9a067dd7 /source4 | |
parent | d78417a5d66f9d7a6d282baa6968eb9ba902328e (diff) | |
download | samba-cb0f8f0ee087475e63bcc969cf501ce9eae9c98f.tar.gz samba-cb0f8f0ee087475e63bcc969cf501ce9eae9c98f.tar.bz2 samba-cb0f8f0ee087475e63bcc969cf501ce9eae9c98f.zip |
s4-repl: load RODC partitions using msDS-hasFullReplicaNCs
we mark these as incoming_only
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/repl/drepl_partitions.c | 30 | ||||
-rw-r--r-- | source4/dsdb/repl/drepl_service.h | 2 |
2 files changed, 28 insertions, 4 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c index cb45b41248..5a11dce50f 100644 --- a/source4/dsdb/repl/drepl_partitions.c +++ b/source4/dsdb/repl/drepl_partitions.c @@ -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); diff --git a/source4/dsdb/repl/drepl_service.h b/source4/dsdb/repl/drepl_service.h index eefd4da7f4..4019bf7307 100644 --- a/source4/dsdb/repl/drepl_service.h +++ b/source4/dsdb/repl/drepl_service.h @@ -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 *, |