summaryrefslogtreecommitdiff
path: root/source4/wrepl_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@sernet.de>2008-03-26 19:33:15 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-19 07:05:52 +0100
commit7c7bdf3669f55b7bd3e2ff138af8f57bcc6596ee (patch)
tree26a2357402048475659c63adc5561129c4efc9b2 /source4/wrepl_server
parente1c968afd85c229490f1e6c13da94a6ef824b122 (diff)
downloadsamba-7c7bdf3669f55b7bd3e2ff138af8f57bcc6596ee.tar.gz
wreplserver: add "wreplsrv:propagate name releases = yes" for replicated sgroup merges
metze (from samba4wins tree 80cbe665e561182d28acc6ad474243b83f3e4d28)
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r--source4/wrepl_server/wrepl_apply_records.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/wrepl_server/wrepl_apply_records.c b/source4/wrepl_server/wrepl_apply_records.c
index 6db093b619f..96a6033b1e1 100644
--- a/source4/wrepl_server/wrepl_apply_records.c
+++ b/source4/wrepl_server/wrepl_apply_records.c
@@ -29,6 +29,7 @@
#include "libcli/wrepl/winsrepl.h"
#include "system/time.h"
#include "librpc/gen_ndr/ndr_nbt.h"
+#include "param/param.h"
enum _R_ACTION {
R_INVALID,
@@ -1190,7 +1191,9 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner,
uint8_t ret;
size_t len;
bool changed_old_addrs = false;
+ bool skip_replica_owned_by_us = false;
bool become_owner = true;
+ bool propagate = lp_parm_bool(partner->service->task->lp_ctx, NULL, "wreplsrv", "propagate name releases", false);
const char *local_owner = partner->service->wins_db->local_owner;
merge = talloc(mem_ctx, struct winsdb_record);
@@ -1251,6 +1254,23 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner,
}
for (i=0; i < replica->num_addresses; i++) {
+ if (propagate &&
+ strcmp(replica->addresses[i].owner, local_owner) == 0) {
+ const struct winsdb_addr *a;
+
+ /*
+ * NOTE: this is different to the windows behavior
+ * and off by default, but it better propagated
+ * name releases
+ */
+ a = winsdb_addr_list_check(merge->addresses,
+ replica->addresses[i].address);
+ if (!a) {
+ /* don't add addresses owned by us */
+ skip_replica_owned_by_us = true;
+ }
+ continue;
+ }
merge->addresses = winsdb_addr_list_add(partner->service->wins_db,
merge, merge->addresses,
replica->addresses[i].address,
@@ -1265,6 +1285,15 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner,
become_owner = false;
}
+ /*
+ * when we notice another server believes an address
+ * is owned by us and that's not the case
+ * we propagate the result
+ */
+ if (skip_replica_owned_by_us) {
+ become_owner = true;
+ }
+
/* if we're the owner of the old record, we'll be the owner of the new one too */
if (strcmp(rec->wins_owner, local_owner)==0) {
become_owner = true;