diff options
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r-- | source4/wrepl_server/wrepl_apply_records.c | 29 |
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 6db093b619..96a6033b1e 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; |