From: Jelmer Vernooij Date: Thu, 6 Dec 2007 15:26:56 +0000 (+0100) Subject: r26309: Move specification of port higher up the all stack. X-Git-Url: http://git.samba.org/samba.git/?p=jelmer%2Fsamba4-debian.git;a=commitdiff_plain;h=7de55cde7c7fe0141c05c8a38248667ebf3a9033 r26309: Move specification of port higher up the all stack. --- diff --git a/source/libcli/nbt/libnbt.h b/source/libcli/nbt/libnbt.h index e38359108..2f7ce8d1b 100644 --- a/source/libcli/nbt/libnbt.h +++ b/source/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/source/libcli/nbt/namequery.c b/source/libcli/nbt/namequery.c index 755e06e88..6bc687819 100644 --- a/source/libcli/nbt/namequery.c +++ b/source/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/source/libcli/resolve/nbtlist.c b/source/libcli/resolve/nbtlist.c index baf3874aa..13010eec3 100644 --- a/source/libcli/resolve/nbtlist.c +++ b/source/libcli/resolve/nbtlist.c @@ -151,6 +151,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, for (i=0;inum_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/source/nbt_server/wins/winswack.c b/source/nbt_server/wins/winswack.c index 304edcf8d..82b16bb20 100644 --- a/source/nbt_server/wins/winswack.c +++ b/source/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/source/torture/nbt/query.c b/source/torture/nbt/query.c index 104033522..c5104f5f0 100644 --- a/source/torture/nbt/query.c +++ b/source/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/source/torture/nbt/wins.c b/source/torture/nbt/wins.c index e25c3e78f..fe87d7f97 100644 --- a/source/torture/nbt/wins.c +++ b/source/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/source/torture/nbt/winsbench.c b/source/torture/nbt/winsbench.c index 27edd5720..34d27ab41 100644 --- a/source/torture/nbt/winsbench.c +++ b/source/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/source/utils/nmblookup.c b/source/utils/nmblookup.c index ada5b839b..2ff758d3b 100644 --- a/source/utils/nmblookup.c +++ b/source/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