summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-14 12:46:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:51 -0500
commit97b2a6f7edebb44c8648684bdd13692e8be3aaf2 (patch)
tree69e1d69a79ddc12ec448930ea03da555e664f6ea
parent240829d53e34ede37d85de67390e4e8288b27514 (diff)
downloadsamba-97b2a6f7edebb44c8648684bdd13692e8be3aaf2.tar.gz
samba-97b2a6f7edebb44c8648684bdd13692e8be3aaf2.tar.bz2
samba-97b2a6f7edebb44c8648684bdd13692e8be3aaf2.zip
r5397: added testing and server support for the special handling required for the 0x1d local master browser name
in WINS (This used to be commit 2650b43ca903fb478d2943fa9bbdba8b2bf74966)
-rw-r--r--source4/nbt_server/winsserver.c6
-rw-r--r--source4/torture/nbt/wins.c15
2 files changed, 20 insertions, 1 deletions
diff --git a/source4/nbt_server/winsserver.c b/source4/nbt_server/winsserver.c
index 38f874a196..45b147d86d 100644
--- a/source4/nbt_server/winsserver.c
+++ b/source4/nbt_server/winsserver.c
@@ -112,6 +112,12 @@ static void nbtd_winsserver_register(struct nbt_name_socket *nbtsock,
uint16_t nb_flags = packet->additional[0].rdata.netbios.addresses[0].nb_flags;
const char *address = packet->additional[0].rdata.netbios.addresses[0].ipaddr;
+ /* as a special case, the local master browser name is always accepted
+ for registration, but never stored */
+ if (name->type == NBT_NAME_MASTER) {
+ goto done;
+ }
+
rec = winsdb_load(winssrv, name, packet);
if (rec == NULL) {
rcode = wins_register_new(nbtsock, packet, src_address, src_port);
diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c
index 0fd8602a35..9258f3b517 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -111,7 +111,7 @@ static BOOL nbt_test_wins_name(TALLOC_CTX *mem_ctx, const char *address,
CHECK_STRING(io.out.wins_server, address);
CHECK_VALUE(io.out.rcode, 0);
- if (nb_flags & NBT_NM_GROUP) {
+ if (name->type != NBT_NAME_MASTER && nb_flags & NBT_NM_GROUP) {
printf("Try to register as non-group\n");
io.in.nb_flags &= ~NBT_NM_GROUP;
status = nbt_name_register_wins(nbtsock, mem_ctx, &io);
@@ -132,6 +132,14 @@ static BOOL nbt_test_wins_name(TALLOC_CTX *mem_ctx, const char *address,
query.in.retries = 0;
status = nbt_name_query(nbtsock, mem_ctx, &query);
+ if (name->type == NBT_NAME_MASTER) {
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ printf("Bad response from %s for name query - %s\n",
+ address, nt_errstr(status));
+ return False;
+ }
+ return ret;
+ }
if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
printf("No response from %s for name query\n", address);
return False;
@@ -287,6 +295,11 @@ static BOOL nbt_test_wins(TALLOC_CTX *mem_ctx, const char *address)
name.scope = NULL;
ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H);
+ name.type = NBT_NAME_MASTER;
+ ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H);
+
+ ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H | NBT_NM_GROUP);
+
name.scope = "example";
name.type = 0x72;
ret &= nbt_test_wins_name(mem_ctx, address, &name, NBT_NODE_H);