From bbe4785f342d6513fd001fdde94a945b2f2b654a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 20 Mar 2008 13:27:13 +0100 Subject: wrepl_server: fix the record expire time of sgroup merges if we're the owner, the expire time becomes the highest expire time of owned addresses metze (from samba4wins tree 024f439db45046c7c0bb4759c75877462405baec) --- source4/wrepl_server/wrepl_apply_records.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source4/wrepl_server/wrepl_apply_records.c b/source4/wrepl_server/wrepl_apply_records.c index 17777f4dcf..6db093b619 100644 --- a/source4/wrepl_server/wrepl_apply_records.c +++ b/source4/wrepl_server/wrepl_apply_records.c @@ -1283,7 +1283,25 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner, * will be owner of the merge result, otherwise we take the ownership */ if (become_owner) { + time_t lh = 0; + modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP; + + /* + * if we're the owner, the expire time becomes the highest + * expire time of owned addresses + */ + len = winsdb_addr_list_length(merge->addresses); + + for (i=0; i < len; i++) { + if (strcmp(merge->addresses[i]->wins_owner, local_owner)==0) { + lh = MAX(lh, merge->addresses[i]->expire_time); + } + } + + if (lh != 0) { + merge->expire_time = lh; + } } ret = winsdb_modify(partner->service->wins_db, merge, modify_flags); -- cgit