summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-10-06 11:14:13 +1100
committerAndrew Tridgell <tridge@samba.org>2011-10-06 14:34:21 +1100
commit2a2deeb3b43dcb11f2b604bdd20c1183e87522bb (patch)
tree6c7130c21858445db91f8c1f137f0c77e015b2e6 /source4/dsdb
parente717af030146db7bc298a581b030cb7535614e0f (diff)
downloadsamba-2a2deeb3b43dcb11f2b604bdd20c1183e87522bb.tar.gz
samba-2a2deeb3b43dcb11f2b604bdd20c1183e87522bb.tar.bz2
samba-2a2deeb3b43dcb11f2b604bdd20c1183e87522bb.zip
s4-rodc: ensure we load replicated partitions for RODCs
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/repl/drepl_partitions.c79
-rw-r--r--source4/dsdb/repl/drepl_service.h2
2 files changed, 35 insertions, 46 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index 7c5424555a..f2d4b1321b 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -34,11 +34,15 @@
#include "param/param.h"
#include "dsdb/common/util.h"
+/*
+ load the partitions list based on replicated NC attributes in our
+ NTDSDSA object
+ */
WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
{
WERROR status;
- static const char *attrs[] = { "hasMasterNCs", "hasPartialReplicaNCs", NULL };
- unsigned int i;
+ static const char *attrs[] = { "hasMasterNCs", "hasPartialReplicaNCs", "msDS-HasFullReplicaNCs", NULL };
+ unsigned int a;
int ret;
TALLOC_CTX *tmp_ctx;
struct ldb_result *res;
@@ -62,57 +66,42 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
return WERR_DS_DRA_INTERNAL_ERROR;
}
- el = ldb_msg_find_element(res->msgs[0], "hasMasterNCs");
-
- for (i=0; el && i<el->num_values; i++) {
- struct ldb_dn *pdn;
- struct dreplsrv_partition *p;
+ for (a=0; attrs[a]; a++) {
+ int i;
- pdn = ldb_dn_from_ldb_val(tmp_ctx, s->samdb, &el->values[i]);
- if (pdn == NULL) {
- talloc_free(tmp_ctx);
- return WERR_DS_DRA_INTERNAL_ERROR;
+ el = ldb_msg_find_element(res->msgs[0], attrs[a]);
+ if (el == NULL) {
+ continue;
}
- if (!ldb_dn_validate(pdn)) {
- return WERR_DS_DRA_INTERNAL_ERROR;
- }
-
- p = talloc_zero(s, struct dreplsrv_partition);
- W_ERROR_HAVE_NO_MEMORY(p);
-
- p->dn = talloc_steal(p, pdn);
- p->service = s;
+ for (i=0; i<el->num_values; i++) {
+ struct ldb_dn *pdn;
+ struct dreplsrv_partition *p;
+
+ pdn = ldb_dn_from_ldb_val(tmp_ctx, s->samdb, &el->values[i]);
+ if (pdn == NULL) {
+ talloc_free(tmp_ctx);
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
+ if (!ldb_dn_validate(pdn)) {
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
- DLIST_ADD(s->partitions, p);
+ p = talloc_zero(s, struct dreplsrv_partition);
+ W_ERROR_HAVE_NO_MEMORY(p);
- DEBUG(2, ("dreplsrv_partition[%s] loaded\n", ldb_dn_get_linearized(p->dn)));
- }
+ p->dn = talloc_steal(p, pdn);
+ p->service = s;
- el = ldb_msg_find_element(res->msgs[0], "hasPartialReplicaNCs");
+ if (strcasecmp(attrs[a], "hasPartialReplicaNCs") == 0) {
+ p->partial_replica = true;
+ } else if (strcasecmp(attrs[a], "msDS-HasFullReplicaNCs") == 0) {
+ p->rodc_replica = true;
+ }
- for (i=0; el && i<el->num_values; i++) {
- struct ldb_dn *pdn;
- struct dreplsrv_partition *p;
+ DLIST_ADD(s->partitions, p);
- pdn = ldb_dn_from_ldb_val(tmp_ctx, s->samdb, &el->values[i]);
- if (pdn == NULL) {
- talloc_free(tmp_ctx);
- return WERR_DS_DRA_INTERNAL_ERROR;
- }
- if (!ldb_dn_validate(pdn)) {
- return WERR_DS_DRA_INTERNAL_ERROR;
+ DEBUG(2, ("dreplsrv_partition[%s] loaded\n", ldb_dn_get_linearized(p->dn)));
}
-
- p = talloc_zero(s, struct dreplsrv_partition);
- W_ERROR_HAVE_NO_MEMORY(p);
-
- p->dn = talloc_steal(p, pdn);
- p->partial_replica = true;
- p->service = s;
-
- DLIST_ADD(s->partitions, p);
-
- DEBUG(2, ("dreplsrv_partition[%s] loaded (partial replica)\n", ldb_dn_get_linearized(p->dn)));
}
talloc_free(tmp_ctx);
diff --git a/source4/dsdb/repl/drepl_service.h b/source4/dsdb/repl/drepl_service.h
index 98564529bb..6daf82d9f4 100644
--- a/source4/dsdb/repl/drepl_service.h
+++ b/source4/dsdb/repl/drepl_service.h
@@ -106,8 +106,8 @@ struct dreplsrv_partition {
*/
struct dreplsrv_partition_source_dsa *notifies;
- bool incoming_only;
bool partial_replica;
+ bool rodc_replica;
};
typedef void (*dreplsrv_extended_callback_t)(struct dreplsrv_service *,