From 8311b9e9e706cfb98136f3bd096eaf2152a71db9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 24 Jan 2006 19:14:08 +0000 Subject: r13116: make sure we don't add more than 25 addresses to a record, and don't return more than 25 in a name query reply we now also order the addresses from the newest owned address to the oldest replica address metze (This used to be commit 602ec0f1c66e6cb9e958e0e7cc10d3294737378a) --- source4/wrepl_server/wrepl_apply_records.c | 48 +++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'source4/wrepl_server') diff --git a/source4/wrepl_server/wrepl_apply_records.c b/source4/wrepl_server/wrepl_apply_records.c index f41957a210..e1b4bcbf39 100644 --- a/source4/wrepl_server/wrepl_apply_records.c +++ b/source4/wrepl_server/wrepl_apply_records.c @@ -686,10 +686,12 @@ static NTSTATUS r_do_add(struct wreplsrv_partner *partner, for (i=0; i < replica->num_addresses; i++) { /* TODO: find out if rec->expire_time is correct here */ - rec->addresses = winsdb_addr_list_add(rec->addresses, + rec->addresses = winsdb_addr_list_add(partner->service->wins_db, + rec, rec->addresses, replica->addresses[i].address, replica->addresses[i].owner, - rec->expire_time); + rec->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(rec->addresses); } @@ -729,10 +731,12 @@ static NTSTATUS r_do_replace(struct wreplsrv_partner *partner, for (i=0; i < replica->num_addresses; i++) { /* TODO: find out if rec->expire_time is correct here */ - rec->addresses = winsdb_addr_list_add(rec->addresses, + rec->addresses = winsdb_addr_list_add(partner->service->wins_db, + rec, rec->addresses, replica->addresses[i].address, replica->addresses[i].owner, - rec->expire_time); + rec->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(rec->addresses); } @@ -829,11 +833,12 @@ static NTSTATUS r_do_mhomed_merge(struct wreplsrv_partner *partner, merge->registered_by = NULL; for (i=0; i < replica->num_addresses; i++) { - /* TODO: find out if rec->expire_time is correct here */ - merge->addresses = winsdb_addr_list_add(merge->addresses, + merge->addresses = winsdb_addr_list_add(partner->service->wins_db, + merge, merge->addresses, replica->addresses[i].address, replica->addresses[i].owner, - merge->expire_time); + merge->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(merge->addresses); } @@ -849,11 +854,12 @@ static NTSTATUS r_do_mhomed_merge(struct wreplsrv_partner *partner, } if (found) continue; - /* TODO: find out if rec->expire_time is correct here */ - merge->addresses = winsdb_addr_list_add(merge->addresses, + merge->addresses = winsdb_addr_list_add(partner->service->wins_db, + merge, merge->addresses, rec->addresses[i]->address, rec->addresses[i]->wins_owner, - merge->expire_time); + rec->addresses[i]->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(merge->addresses); } @@ -1198,34 +1204,36 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner, break; } - /* if it's also in the replica, it'll added later */ - if (found) continue; - /* * if the address isn't in the replica and is owned by replicas owner, * it won't be added to the merged record */ - if (strcmp(rec->addresses[i]->wins_owner, owner->address) == 0) { + if (!found && strcmp(rec->addresses[i]->wins_owner, owner->address) == 0) { changed_old_addrs = True; continue; } /* - * add the address to the merge result, with the old owner and expire_time + * add the address to the merge result, with the old owner and expire_time, + * the owner and expire_time will be overwritten later if the address is + * in the replica too */ - merge->addresses = winsdb_addr_list_add(merge->addresses, + merge->addresses = winsdb_addr_list_add(partner->service->wins_db, + merge, merge->addresses, rec->addresses[i]->address, rec->addresses[i]->wins_owner, - rec->addresses[i]->expire_time); + rec->addresses[i]->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(merge->addresses); } for (i=0; i < replica->num_addresses; i++) { - /* TODO: find out if rec->expire_time is correct here */ - merge->addresses = winsdb_addr_list_add(merge->addresses, + merge->addresses = winsdb_addr_list_add(partner->service->wins_db, + merge, merge->addresses, replica->addresses[i].address, replica->addresses[i].owner, - merge->expire_time); + merge->expire_time, + False); NT_STATUS_HAVE_NO_MEMORY(merge->addresses); } -- cgit