summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-11-28 00:28:44 +0100
committerMatthieu Patou <mat@samba.org>2011-12-05 19:56:09 +0100
commit5bfd6251eb22ff701184a95649822a73cf4d157b (patch)
tree7dad3b2e44e79e5f09e8043a32d565cb8be44c43
parent059523e2036d8a2215fd4ea59047e2d9dacce062 (diff)
downloadsamba-5bfd6251eb22ff701184a95649822a73cf4d157b.tar.gz
samba-5bfd6251eb22ff701184a95649822a73cf4d157b.tar.bz2
samba-5bfd6251eb22ff701184a95649822a73cf4d157b.zip
s4-drs: do not try to contact for replication servers that are not anymore in reps*
Servers connection can be removed from repsTo and respFrom either due to DC demote or topology change by the KCC, if a server is removed from the reps* it must be effectivly removed from the list of server that we will contact for getNcChanges and for replicaSync. Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Mon Dec 5 19:56:09 CET 2011 on sn-devel-104
-rw-r--r--source4/dsdb/repl/drepl_partitions.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index 927dc68766..de5d0072ce 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -376,6 +376,7 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
struct dreplsrv_partition *p,
struct dreplsrv_partition_source_dsa **listp,
struct dreplsrv_partition_source_dsa *check_list,
+ struct dreplsrv_partition_source_dsa **oldlist,
const struct ldb_val *val)
{
WERROR status;
@@ -413,14 +414,16 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
}
/* re-use an existing source if found */
- for (s2=*listp; s2; s2=s2->next) {
+ for (s2=*oldlist; s2; s2=s2->next) {
if (GUID_compare(&s2->repsFrom1->source_dsa_obj_guid,
&source->repsFrom1->source_dsa_obj_guid) == 0) {
talloc_free(s2->repsFrom1->other_info);
*s2->repsFrom1 = *source->repsFrom1;
talloc_steal(s2, s2->repsFrom1->other_info);
talloc_free(source);
- return WERR_OK;
+ source = s2;
+ DLIST_REMOVE(*oldlist, s2);
+ break;
}
}
@@ -566,6 +569,7 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
NULL
};
struct ldb_dn *dn;
+ struct dreplsrv_partition_source_dsa *src, *oldsources, *oldnotifies;
DEBUG(4, ("dreplsrv_refresh_partition(%s)\n",
ldb_dn_get_linearized(p->dn)));
@@ -607,22 +611,52 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
status = WERR_OK;
+ oldsources = p->sources;
+ p->sources = NULL;
if (r != NULL && (orf_el = ldb_msg_find_element(r->msgs[0], "repsFrom"))) {
for (i=0; i < orf_el->num_values; i++) {
- status = dreplsrv_partition_add_source_dsa(s, p, &p->sources,
- NULL, &orf_el->values[i]);
+ status = dreplsrv_partition_add_source_dsa(s, p, &p->sources,
+ NULL, &oldsources,
+ &orf_el->values[i]);
W_ERROR_NOT_OK_GOTO_DONE(status);
}
+ } else {
+ if (r != NULL && p->sources) {
+ DEBUG(0, ("repsFrom do not exists or is empty\n"));
+ }
}
+ oldnotifies = p->notifies;
+ p->notifies = NULL;
if (r != NULL && (orf_el = ldb_msg_find_element(r->msgs[0], "repsTo"))) {
for (i=0; i < orf_el->num_values; i++) {
- status = dreplsrv_partition_add_source_dsa(s, p, &p->notifies,
- p->sources, &orf_el->values[i]);
+ status = dreplsrv_partition_add_source_dsa(s, p, &p->notifies,
+ p->sources,
+ &oldnotifies,
+ &orf_el->values[i]);
W_ERROR_NOT_OK_GOTO_DONE(status);
}
}
+ if (oldsources) {
+ src = oldsources;
+ while(src) {
+ struct dreplsrv_partition_source_dsa *tmp = src->next;
+ talloc_free(src);
+ src = tmp;
+ }
+ }
+
+
+ if (oldnotifies) {
+ src = oldnotifies;
+ while(src) {
+ struct dreplsrv_partition_source_dsa *tmp = src->next;
+ talloc_free(src);
+ src = tmp;
+ }
+ }
+
done:
talloc_free(mem_ctx);
return status;