summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/finddcs.c1
-rw-r--r--source4/libcli/nbt/libnbt.h1
-rw-r--r--source4/libcli/nbt/namequery.c2
-rw-r--r--source4/utils/nmblookup.c7
4 files changed, 7 insertions, 4 deletions
diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c
index 415c84a6bd..624f6cd630 100644
--- a/source4/libcli/finddcs.c
+++ b/source4/libcli/finddcs.c
@@ -189,6 +189,7 @@ static void fallback_node_status(struct finddcs_state *state)
state->node_status.in.name.type = NBT_NAME_CLIENT;
state->node_status.in.name.scope = NULL;
state->node_status.in.dest_addr = state->dcs[0].address;
+ state->node_status.in.dest_port = lp_nbt_port(global_loadparm);
state->node_status.in.timeout = 1;
state->node_status.in.retries = 2;
diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h
index 2f7ce8d1b4..f4bb71764a 100644
--- a/source4/libcli/nbt/libnbt.h
+++ b/source4/libcli/nbt/libnbt.h
@@ -147,6 +147,7 @@ struct nbt_name_status {
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
int timeout; /* in seconds */
int retries;
} in;
diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c
index 6bc6878194..e3432bfda1 100644
--- a/source4/libcli/nbt/namequery.c
+++ b/source4/libcli/nbt/namequery.c
@@ -158,7 +158,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *n
packet->questions[0].question_class = NBT_QCLASS_IP;
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
- io->in.dest_addr, lp_nbt_port(global_loadparm));
+ io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index a3e33e2748..1471dfb5b7 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -104,7 +104,7 @@ static char *node_status_flags(TALLOC_CTX *mem_ctx, uint16_t flags)
/* do a single node status */
static bool do_node_status(struct nbt_name_socket *nbtsock,
- const char *addr)
+ const char *addr, uint16_t port)
{
struct nbt_name_status io;
NTSTATUS status;
@@ -113,6 +113,7 @@ static bool do_node_status(struct nbt_name_socket *nbtsock,
io.in.name.type = NBT_NAME_CLIENT;
io.in.name.scope = NULL;
io.in.dest_addr = addr;
+ io.in.dest_port = port;
io.in.timeout = 1;
io.in.retries = 2;
@@ -172,7 +173,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
io.out.name.type);
}
if (options.node_status && io.out.num_addrs > 0) {
- do_node_status(nbtsock, io.out.reply_addrs[0]);
+ do_node_status(nbtsock, io.out.reply_addrs[0], port);
}
return status;
@@ -229,7 +230,7 @@ static bool process_one(struct loadparm_context *lp_ctx, const char *name, int n
}
if (options.lookup_by_ip) {
- ret = do_node_status(nbtsock, name);
+ ret = do_node_status(nbtsock, name, nbt_port);
talloc_free(tmp_ctx);
return ret;
}