summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-06 16:26:56 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:48:21 +0100
commitb84be078c197f9752b53d68c882f4d1b44979b8e (patch)
treebde019464dc96ee6c66837ab90a56ed3a9f6b837
parentfd1870e4f7370a184850e35a3d83157c664a79de (diff)
downloadsamba-b84be078c197f9752b53d68c882f4d1b44979b8e.tar.gz
samba-b84be078c197f9752b53d68c882f4d1b44979b8e.tar.bz2
samba-b84be078c197f9752b53d68c882f4d1b44979b8e.zip
r26309: Move specification of port higher up the all stack.
(This used to be commit 7de55cde7c7fe0141c05c8a38248667ebf3a9033)
-rw-r--r--source4/libcli/nbt/libnbt.h1
-rw-r--r--source4/libcli/nbt/namequery.c2
-rw-r--r--source4/libcli/resolve/nbtlist.c1
-rw-r--r--source4/nbt_server/wins/winswack.c3
-rw-r--r--source4/torture/nbt/query.c2
-rw-r--r--source4/torture/nbt/wins.c2
-rw-r--r--source4/torture/nbt/winsbench.c2
-rw-r--r--source4/utils/nmblookup.c12
8 files changed, 21 insertions, 4 deletions
diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h
index e383591089..2f7ce8d1b4 100644
--- a/source4/libcli/nbt/libnbt.h
+++ b/source4/libcli/nbt/libnbt.h
@@ -128,6 +128,7 @@ struct nbt_name_query {
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
bool broadcast;
bool wins_lookup;
int timeout; /* in seconds */
diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c
index 755e06e880..6bc6878194 100644
--- a/source4/libcli/nbt/namequery.c
+++ b/source4/libcli/nbt/namequery.c
@@ -54,7 +54,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nb
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/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c
index baf3874aa4..13010eec3e 100644
--- a/source4/libcli/resolve/nbtlist.c
+++ b/source4/libcli/resolve/nbtlist.c
@@ -151,6 +151,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
for (i=0;i<state->num_queries;i++) {
state->io_queries[i].in.name = state->name;
state->io_queries[i].in.dest_addr = talloc_strdup(state->io_queries, address_list[i]);
+ state->io_queries[i].in.dest_port = lp_nbt_port(global_loadparm);
if (composite_nomem(state->io_queries[i].in.dest_addr, c)) return c;
state->io_queries[i].in.broadcast = broadcast;
diff --git a/source4/nbt_server/wins/winswack.c b/source4/nbt_server/wins/winswack.c
index 304edcf8de..82b16bb20d 100644
--- a/source4/nbt_server/wins/winswack.c
+++ b/source4/nbt_server/wins/winswack.c
@@ -26,6 +26,7 @@
#include "nbt_server/wins/winsserver.h"
#include "system/time.h"
#include "libcli/composite/composite.h"
+#include "param/param.h"
struct wins_challenge_state {
struct wins_challenge_io *io;
@@ -46,6 +47,7 @@ static void wins_challenge_handler(struct nbt_name_request *req)
if (state->current_address < state->io->in.num_addresses) {
struct nbtd_interface *iface;
+ state->query.in.dest_port = lp_nbt_port(global_loadparm);
state->query.in.dest_addr = state->io->in.addresses[state->current_address];
iface = nbtd_find_request_iface(state->io->in.nbtd_server, state->query.in.dest_addr, true);
@@ -103,6 +105,7 @@ struct composite_context *wins_challenge_send(TALLOC_CTX *mem_ctx, struct wins_c
/* setup a name query to the first address */
state->query.in.name = *state->io->in.name;
+ state->query.in.dest_port = lp_nbt_port(global_loadparm);
state->query.in.dest_addr = state->io->in.addresses[state->current_address];
state->query.in.broadcast = false;
state->query.in.wins_lookup = true;
diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c
index 1040335227..c5104f5f06 100644
--- a/source4/torture/nbt/query.c
+++ b/source4/torture/nbt/query.c
@@ -24,6 +24,7 @@
#include "libcli/resolve/resolve.h"
#include "torture/torture.h"
#include "torture/nbt/proto.h"
+#include "param/param.h"
struct result_struct {
int num_pass;
@@ -61,6 +62,7 @@ static bool bench_namequery(struct torture_context *tctx)
io.in.name = name;
io.in.dest_addr = address;
+ io.in.dest_port = lp_nbt_port(global_loadparm);
io.in.broadcast = false;
io.in.wins_lookup = false;
io.in.timeout = 1;
diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c
index e25c3e78f0..fe87d7f971 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -27,6 +27,7 @@
#include "librpc/gen_ndr/ndr_nbt.h"
#include "torture/torture.h"
#include "torture/nbt/proto.h"
+#include "param/param.h"
#define CHECK_VALUE(tctx, v, correct) \
torture_assert_int_equal(tctx, v, correct, "Incorrect value")
@@ -113,6 +114,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
torture_comment(tctx, "query the name to make sure its there\n");
query.in.name = *name;
query.in.dest_addr = address;
+ query.in.dest_port = lp_nbt_port(tctx->lp_ctx);
query.in.broadcast = false;
query.in.wins_lookup = true;
query.in.timeout = 3;
diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c
index 27edd57206..34d27ab410 100644
--- a/source4/torture/nbt/winsbench.c
+++ b/source4/torture/nbt/winsbench.c
@@ -27,6 +27,7 @@
#include "lib/socket/netif.h"
#include "torture/torture.h"
#include "torture/nbt/proto.h"
+#include "param/param.h"
struct wins_state {
int num_names;
@@ -184,6 +185,7 @@ static void generate_query(struct nbt_name_socket *nbtsock, struct wins_state *s
io.in.name = generate_name(tmp_ctx, idx);
io.in.dest_addr = state->wins_server;
+ io.in.dest_port = lp_nbt_port(global_loadparm);
io.in.broadcast = false;
io.in.wins_lookup = true;
io.in.timeout = 2;
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index ada5b839b7..2ff758d3b0 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -29,6 +29,7 @@
#include "lib/socket/netif.h"
#include "librpc/gen_ndr/nbt.h"
#include "libcli/nbt/libnbt.h"
+#include "param/param.h"
/* command line options */
static struct {
@@ -142,6 +143,7 @@ static bool do_node_status(struct nbt_name_socket *nbtsock,
/* do a single node query */
static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
const char *addr,
+ uint16_t port,
const char *node_name,
enum nbt_name_type node_type,
bool broadcast)
@@ -154,6 +156,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
io.in.name.type = node_type;
io.in.name.scope = NULL;
io.in.dest_addr = addr;
+ io.in.dest_port = port;
io.in.broadcast = broadcast;
io.in.wins_lookup = options.wins_lookup;
io.in.timeout = 1;
@@ -232,15 +235,18 @@ static bool process_one(const char *name)
}
if (options.broadcast_address) {
- status = do_node_query(nbtsock, options.broadcast_address, node_name, node_type, true);
+ status = do_node_query(nbtsock, options.broadcast_address, lp_nbt_port(global_loadparm),
+ node_name, node_type, true);
} else if (options.unicast_address) {
- status = do_node_query(nbtsock, options.unicast_address, node_name, node_type, false);
+ status = do_node_query(nbtsock, options.unicast_address,
+ lp_nbt_port(global_loadparm), node_name, node_type, false);
} else {
int i, num_interfaces = iface_count();
for (i=0;i<num_interfaces;i++) {
const char *bcast = iface_n_bcast(i);
if (bcast == NULL) continue;
- status = do_node_query(nbtsock, bcast, node_name, node_type, true);
+ status = do_node_query(nbtsock, bcast, lp_nbt_port(global_loadparm),
+ node_name, node_type, true);
if (NT_STATUS_IS_OK(status)) break;
}
}