mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r26309: Move specification of port higher up the all stack.
This commit is contained in:
parent
bd2d6e0595
commit
7de55cde7c
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user