winsserver_release: update the expire time if only one address is released
authorStefan Metzmacher <metze@sernet.de>
Tue, 25 Mar 2008 16:30:52 +0000 (17:30 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 19 Jan 2009 06:05:52 +0000 (07:05 +0100)
We also take the ownership if the record isn't owned.
This matches windows...

metze
(from samba4wins tree d7b19339c0444cbe0989fcfa91a22323215d2f6b)

source4/nbt_server/wins/winsserver.c

index c9d19936ed2c1f12f50a99e27170f90d24427c99..464bf804a7000f8b6987a206c64b7a721974dad4 100644 (file)
@@ -939,7 +939,18 @@ static void nbtd_winsserver_release(struct nbt_name_socket *nbtsock,
                break;
        }
 
-       if (rec->state == WREPL_STATE_RELEASED) {
+       if (rec->state == WREPL_STATE_ACTIVE) {
+               /*
+                * If the record is still active, we need to update the
+                * expire_time.
+                *
+                * if we're not the owner, we need to take the ownership.
+                */
+               rec->expire_time= time(NULL) + winssrv->config.max_renew_interval;
+               if (strcmp(rec->wins_owner, winssrv->wins_db->local_owner) != 0) {
+                       modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP;
+               }
+       } else if (rec->state == WREPL_STATE_RELEASED) {
                /*
                 * if we're not the owner, we need to take the owner ship
                 * and make the record tombstone, but expire after