mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
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)
This commit is contained in:
parent
34be0772d2
commit
a417674925
@ -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"
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user