summaryrefslogtreecommitdiff
path: root/source4/nbt_server/wins/winsserver.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-01-03 20:03:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:41 -0500
commita417674925b745d44da536d9d69e907afa4a0f88 (patch)
tree688e623421f967972071c625d574422d280b0684 /source4/nbt_server/wins/winsserver.c
parent34be0772d2a24c3836cfe7a335184ba2d8902e81 (diff)
downloadsamba-a417674925b745d44da536d9d69e907afa4a0f88.tar.gz
samba-a417674925b745d44da536d9d69e907afa4a0f88.tar.bz2
samba-a417674925b745d44da536d9d69e907afa4a0f88.zip
r12700: fix name release of replica records, we need to become the owner and allocate a new versionID
so that it gets replicated to the old owning wins server directly metze (This used to be commit 72198f00ea933db68f7ec5d85cac00c98b37a077)
Diffstat (limited to 'source4/nbt_server/wins/winsserver.c')
-rw-r--r--source4/nbt_server/wins/winsserver.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index d6eeb69ada..98ae613905 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -731,7 +731,23 @@ static void nbtd_winsserver_release(struct nbt_name_socket *nbtsock,
}
if (rec->state == WREPL_STATE_RELEASED) {
- rec->expire_time = time(NULL) + winssrv->config.tombstone_interval;
+ /*
+ * if we're not the owner, we need to take the owner ship
+ * and make the record tombstone, but expire after
+ * tombstone_interval + tombstone_timeout and not only after tombstone_timeout
+ * like for normal tombstone records.
+ * This is to replicate the record directly to the original owner,
+ * where the record is still active
+ */
+ if (strcmp(rec->wins_owner, winssrv->wins_db->local_owner) == 0) {
+ rec->expire_time= time(NULL) + winssrv->config.tombstone_interval;
+ } else {
+ rec->state = WREPL_STATE_TOMBSTONE;
+ rec->expire_time= time(NULL) +
+ winssrv->config.tombstone_interval +
+ winssrv->config.tombstone_timeout;
+ modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP;
+ }
}
ret = winsdb_modify(winssrv->wins_db, rec, modify_flags);
@@ -783,7 +799,7 @@ void nbtd_winsserver_request(struct nbt_name_socket *nbtsock,
*/
NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
{
- uint32_t tombstone_interval;
+ uint32_t tmp;
if (!lp_wins_support()) {
nbtsrv->winssrv = NULL;
@@ -795,8 +811,10 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl();
nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl();
- tombstone_interval = lp_parm_int(-1,"wreplsrv","tombstone_interval", 6*24*60*60);
- nbtsrv->winssrv->config.tombstone_interval = tombstone_interval;
+ tmp = lp_parm_int(-1,"wreplsrv","tombstone_interval", 6*24*60*60);
+ nbtsrv->winssrv->config.tombstone_interval = tmp;
+ tmp = lp_parm_int(-1,"wreplsrv","tombstone_timeout", 1*24*60*60);
+ nbtsrv->winssrv->config.tombstone_timeout = tmp;
nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv);
if (!nbtsrv->winssrv->wins_db) {