summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-14 08:38:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:22 -0500
commit2759fc850b8cf5f58207b642e0d2d922d884a813 (patch)
treea5b730baf5e2d9379ade973909dd299f600fb136 /source4
parenta1827a1deba04e0b4b2a508dc4e4e66603a46d16 (diff)
downloadsamba-2759fc850b8cf5f58207b642e0d2d922d884a813.tar.gz
samba-2759fc850b8cf5f58207b642e0d2d922d884a813.tar.bz2
samba-2759fc850b8cf5f58207b642e0d2d922d884a813.zip
r12228: fix the expire time for RELEASED records
metze (This used to be commit afb0f660a2e4e5ae78c2906e2acf9eba50ea598f)
Diffstat (limited to 'source4')
-rw-r--r--source4/nbt_server/wins/winsdb.h17
-rw-r--r--source4/nbt_server/wins/winsserver.c19
2 files changed, 29 insertions, 7 deletions
diff --git a/source4/nbt_server/wins/winsdb.h b/source4/nbt_server/wins/winsdb.h
index 8661baa3dc..2cf3b56c74 100644
--- a/source4/nbt_server/wins/winsdb.h
+++ b/source4/nbt_server/wins/winsdb.h
@@ -54,6 +54,19 @@ struct wins_server {
/* wins server database handle */
struct ldb_context *wins_db;
- uint32_t min_ttl;
- uint32_t max_ttl;
+ /* some configuration */
+ struct {
+ /*
+ * the interval (in secs) till an active record will be marked as RELEASED
+ */
+ uint32_t min_renew_interval;
+ uint32_t max_renew_interval;
+
+ /*
+ * the interval (in secs) a record remains in RELEASED state,
+ * before it will be marked as TOMBSTONE
+ * (also known as extinction interval)
+ */
+ uint32_t tombstone_interval;
+ } config;
};
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index d187ab65ab..8ea437f618 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -4,7 +4,8 @@
core wins server handling
Copyright (C) Andrew Tridgell 2005
-
+ Copyright (C) Stefan Metzmacher 2005
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -31,8 +32,8 @@
*/
uint32_t wins_server_ttl(struct wins_server *winssrv, uint32_t ttl)
{
- ttl = MIN(ttl, winssrv->max_ttl);
- ttl = MAX(ttl, winssrv->min_ttl);
+ ttl = MIN(ttl, winssrv->config.max_renew_interval);
+ ttl = MAX(ttl, winssrv->config.min_renew_interval);
return ttl;
}
@@ -419,6 +420,10 @@ static void nbtd_winsserver_release(struct nbt_name_socket *nbtsock,
break;
}
+ if (rec->state == WREPL_STATE_RELEASED) {
+ rec->expire_time = winssrv->config.tombstone_interval;
+ }
+
ret = winsdb_modify(winssrv->wins_db, rec, modify_flags);
if (ret != NBT_RCODE_OK) {
DEBUG(1,("WINS: FAILED: released name %s at %s: error:%u\n",
@@ -468,6 +473,8 @@ void nbtd_winsserver_request(struct nbt_name_socket *nbtsock,
*/
NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
{
+ uint32_t tombstone_interval;
+
if (!lp_wins_support()) {
nbtsrv->winssrv = NULL;
return NT_STATUS_OK;
@@ -476,8 +483,10 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
nbtsrv->winssrv = talloc_zero(nbtsrv, struct wins_server);
NT_STATUS_HAVE_NO_MEMORY(nbtsrv->winssrv);
- nbtsrv->winssrv->max_ttl = lp_max_wins_ttl();
- nbtsrv->winssrv->min_ttl = lp_min_wins_ttl();
+ 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;
nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv);
if (!nbtsrv->winssrv->wins_db) {