summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/wins/winsdb.h21
-rw-r--r--source4/nbt_server/wins/winsserver.c26
-rw-r--r--source4/nbt_server/wins/winsserver.h29
3 files changed, 51 insertions, 25 deletions
diff --git a/source4/nbt_server/wins/winsdb.h b/source4/nbt_server/wins/winsdb.h
index 6bc1442f3c..1163d96e91 100644
--- a/source4/nbt_server/wins/winsdb.h
+++ b/source4/nbt_server/wins/winsdb.h
@@ -55,25 +55,4 @@ struct winsdb_handle {
const char *local_owner;
};
-struct wins_server {
- /* wins server database handle */
- struct winsdb_handle *wins_db;
-
- /* 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;
-};
-
#include "nbt_server/wins/winsdb_proto.h"
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) {
diff --git a/source4/nbt_server/wins/winsserver.h b/source4/nbt_server/wins/winsserver.h
index 0ac40e7501..aae2e3dfbc 100644
--- a/source4/nbt_server/wins/winsserver.h
+++ b/source4/nbt_server/wins/winsserver.h
@@ -20,6 +20,35 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+struct wins_server {
+ /* wins server database handle */
+ struct winsdb_handle *wins_db;
+
+ /* 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;
+
+ /*
+ * the interval (in secs) a record remains in TOMBSTONE state,
+ * before it will be removed from the database.
+ * See also 'tombstone_extra_timeout'.
+ * (also known as extinction timeout)
+ */
+ uint32_t tombstone_timeout;
+ } config;
+};
+
struct wins_challenge_io {
struct {
struct nbtd_server *nbtd_server;