From 5257693496ea430263958a16b81b6df4043b1797 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 23 Nov 2005 11:34:46 +0000 Subject: r11877: - give winsdb_add/modify/delete() ldb_context as first argument and add a flags argument to add and modify,the current flags are: WINSDB_FLAG_ALLOC_VERSION to allocate a new version id for the record WINSDB_FLAG_TAKE_OWNERSHIP to take the become the wins owner of the record - fix handling of records with no addresses, this is valid for MHOMED and SGROUP records when they're not in ACTIVE state metze (This used to be commit 0ffea2a7b898b1807e4cdcfbbeba9bd0c6792231) --- source4/nbt_server/wins/winsserver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source4/nbt_server/wins/winsserver.c') diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index 8a42e0a589..19b9c6c47f 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -83,7 +83,7 @@ static uint8_t wins_register_new(struct nbt_name_socket *nbtsock, rec.is_static = False; rec.expire_time = time(NULL) + ttl; rec.version = 0; /* will allocated later */ - rec.wins_owner = WINSDB_OWNER_LOCAL; + rec.wins_owner = NULL; /* will be set later */ rec.registered_by = src->addr; rec.addresses = winsdb_addr_list_make(packet); if (rec.addresses == NULL) return NBT_RCODE_SVR; @@ -97,7 +97,7 @@ static uint8_t wins_register_new(struct nbt_name_socket *nbtsock, DEBUG(4,("WINS: accepted registration of %s with address %s\n", nbt_name_string(packet, name), rec.addresses[0]->address)); - return winsdb_add(winssrv, &rec); + return winsdb_add(winssrv->wins_db, &rec, WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP); } @@ -124,7 +124,7 @@ static uint8_t wins_update_ttl(struct nbt_name_socket *nbtsock, DEBUG(5,("WINS: refreshed registration of %s at %s\n", nbt_name_string(packet, rec->name), address)); - return winsdb_modify(winssrv, rec); + return winsdb_modify(winssrv->wins_db, rec, 0); } /* @@ -164,7 +164,8 @@ static void nbtd_winsserver_register(struct nbt_name_socket *nbtsock, rcode = NBT_RCODE_SVR; goto done; } else if (rec->state != WREPL_STATE_ACTIVE) { - winsdb_delete(winssrv, rec); +/* TODO: this is not always correct!!!*/ + winsdb_delete(winssrv->wins_db, rec); rcode = wins_register_new(nbtsock, packet, src); goto done; } @@ -291,7 +292,7 @@ static void nbtd_winsserver_release(struct nbt_name_socket *nbtsock, if (rec->addresses[0] == NULL) { rec->state = WREPL_STATE_RELEASED; } - winsdb_modify(winssrv, rec); + winsdb_modify(winssrv->wins_db, rec, 0); } done: -- cgit