summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-10-25 15:06:07 +1100
committerAndrew Tridgell <tridge@samba.org>2011-11-02 15:26:55 +1100
commitc8ac3678ad98bc27cf08f3d14bae2aa52318c48d (patch)
tree38ec706210378ea317902d8c67fbb2a028e6491e /source4
parent4a6410df54fdbc8fb08b104c47010db507443def (diff)
downloadsamba-c8ac3678ad98bc27cf08f3d14bae2aa52318c48d.tar.gz
samba-c8ac3678ad98bc27cf08f3d14bae2aa52318c48d.tar.bz2
samba-c8ac3678ad98bc27cf08f3d14bae2aa52318c48d.zip
s4-drepl: Search for application partitions in addition to main ones
To replicate application partitions (e.g. DNS partitions) consult msDs-hasMasterNCs attribute as well. Also, make sure we don't add same partition twice in the list. hasMasterNCs and msDs-hasMasterNCs have domain, configuration and schema partitions common. Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/repl/drepl_partitions.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index f2d4b1321b..70f9971a7c 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -41,7 +41,7 @@
WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
{
WERROR status;
- static const char *attrs[] = { "hasMasterNCs", "hasPartialReplicaNCs", "msDS-HasFullReplicaNCs", NULL };
+ static const char *attrs[] = { "hasMasterNCs", "msDs-hasMasterNCs", "hasPartialReplicaNCs", "msDS-HasFullReplicaNCs", NULL };
unsigned int a;
int ret;
TALLOC_CTX *tmp_ctx;
@@ -75,7 +75,8 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
}
for (i=0; i<el->num_values; i++) {
struct ldb_dn *pdn;
- struct dreplsrv_partition *p;
+ struct dreplsrv_partition *p, *tp;
+ bool found;
pdn = ldb_dn_from_ldb_val(tmp_ctx, s->samdb, &el->values[i]);
if (pdn == NULL) {
@@ -98,8 +99,20 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s)
p->rodc_replica = true;
}
- DLIST_ADD(s->partitions, p);
+ /* Do not add partitions more than once */
+ found = false;
+ for (tp = s->partitions; tp; tp = tp->next) {
+ if (ldb_dn_compare(tp->dn, p->dn) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ talloc_free(p);
+ continue;
+ }
+ DLIST_ADD(s->partitions, p);
DEBUG(2, ("dreplsrv_partition[%s] loaded\n", ldb_dn_get_linearized(p->dn)));
}
}