summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/defense.c3
-rw-r--r--source4/nbt_server/nbt_server.h4
-rw-r--r--source4/nbt_server/winsserver.c6
-rw-r--r--source4/nbt_server/winswack.c16
4 files changed, 20 insertions, 9 deletions
diff --git a/source4/nbt_server/defense.c b/source4/nbt_server/defense.c
index c59877e4b7..8d71b31c65 100644
--- a/source4/nbt_server/defense.c
+++ b/source4/nbt_server/defense.c
@@ -56,7 +56,8 @@ void nbtd_request_defense(struct nbt_name_socket *nbtsock,
name = &packet->questions[0].name;
iname = nbtd_find_iname(iface, name, NBT_NM_ACTIVE);
- if (iname != NULL && !(iname->nb_flags & NBT_NM_GROUP)) {
+ if (iname != NULL &&
+ !IS_GROUP_NAME(name, iname->nb_flags)) {
DEBUG(2,("Defending name %s on %s against %s\n",
nbt_name_string(packet, name),
iface->bcast_address, src_address));
diff --git a/source4/nbt_server/nbt_server.h b/source4/nbt_server/nbt_server.h
index a698ebf1a0..6a7b14a546 100644
--- a/source4/nbt_server/nbt_server.h
+++ b/source4/nbt_server/nbt_server.h
@@ -79,3 +79,7 @@ struct nbtd_server {
return; \
} \
} while (0)
+
+/* this copes with the nasty hack that is the type 0x1c name */
+#define IS_GROUP_NAME(name, nb_flags) \
+ ((name)->type != NBT_NAME_LOGON && (nb_flags & NBT_NM_GROUP))
diff --git a/source4/nbt_server/winsserver.c b/source4/nbt_server/winsserver.c
index 45b147d86d..c1eed0b1fa 100644
--- a/source4/nbt_server/winsserver.c
+++ b/source4/nbt_server/winsserver.c
@@ -56,7 +56,7 @@ static uint8_t wins_register_new(struct nbt_name_socket *nbtsock,
rec.state = WINS_REC_ACTIVE;
rec.expire_time = time(NULL) + ttl;
rec.registered_by = src_address;
- if (nb_flags & NBT_NM_GROUP) {
+ if (IS_GROUP_NAME(name, nb_flags)) {
rec.addresses = str_list_make(packet, "255.255.255.255", NULL);
} else {
rec.addresses = str_list_make(packet, address, NULL);
@@ -145,7 +145,7 @@ static void nbtd_winsserver_register(struct nbt_name_socket *nbtsock,
/* if the registration is for a group, then just update the expiry time
and we are done */
- if (nb_flags & NBT_NM_GROUP) {
+ if (IS_GROUP_NAME(name, nb_flags)) {
wins_update_ttl(nbtsock, packet, rec, src_address, src_port);
goto done;
}
@@ -207,7 +207,7 @@ static void nbtd_winsserver_release(struct nbt_name_socket *nbtsock,
rec = winsdb_load(winssrv, name, packet);
if (rec == NULL ||
rec->state != WINS_REC_ACTIVE ||
- (rec->nb_flags & NBT_NM_GROUP)) {
+ IS_GROUP_NAME(name, rec->nb_flags)) {
goto done;
}
diff --git a/source4/nbt_server/winswack.c b/source4/nbt_server/winswack.c
index a15f0a7d06..190b1cdec7 100644
--- a/source4/nbt_server/winswack.c
+++ b/source4/nbt_server/winswack.c
@@ -173,11 +173,6 @@ void wins_register_wack(struct nbt_name_socket *nbtsock,
state->src_address = talloc_strdup(state, src_address);
if (state->src_address == NULL) goto failed;
- /* send a WACK to the client, specifying the maximum time it could
- take to check with the owner, plus some slack */
- ttl = 5 + 4 * str_list_length(rec->addresses);
- nbtd_wack_reply(nbtsock, packet, src_address, src_port, ttl);
-
/* setup a name query to the first address */
state->query.in.name = *rec->name;
state->query.in.dest_addr = state->owner_addresses[0];
@@ -186,6 +181,17 @@ void wins_register_wack(struct nbt_name_socket *nbtsock,
state->query.in.timeout = 1;
state->query.in.retries = 2;
+ /* the LOGON type is a nasty hack */
+ if (rec->name->type == NBT_NAME_LOGON) {
+ wins_wack_allow(state);
+ return;
+ }
+
+ /* send a WACK to the client, specifying the maximum time it could
+ take to check with the owner, plus some slack */
+ ttl = 5 + 4 * str_list_length(rec->addresses);
+ nbtd_wack_reply(nbtsock, packet, src_address, src_port, ttl);
+
req = nbt_name_query_send(nbtsock, &state->query);
if (req == NULL) goto failed;