summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/finddcs.c6
-rw-r--r--source4/libcli/nbt/libnbt.h4
-rw-r--r--source4/libcli/nbt/namerefresh.c6
-rw-r--r--source4/libcli/nbt/nameregister.c8
-rw-r--r--source4/libcli/nbt/namerelease.c2
-rw-r--r--source4/libcli/nbt/nbtsocket.c2
6 files changed, 19 insertions, 9 deletions
diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c
index 624f6cd630..4b7f2dce8c 100644
--- a/source4/libcli/finddcs.c
+++ b/source4/libcli/finddcs.c
@@ -43,6 +43,7 @@ struct finddcs_state {
int num_dcs;
struct nbt_dc_name *dcs;
+ uint16_t nbt_port;
};
static void finddcs_name_resolved(struct composite_context *ctx);
@@ -82,6 +83,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx,
state->ctx = c;
+ state->nbt_port = lp_nbt_port(global_loadparm);
state->my_netbios_name = talloc_strdup(state, my_netbios_name);
state->domain_name = talloc_strdup(state, domain_name);
if (composite_nomem(state->domain_name, c)) return c;
@@ -177,7 +179,7 @@ static void finddcs_getdc_replied(struct irpc_request *ireq)
composite_done(state->ctx);
}
-/* The GetDC request might not be availible (such as occours when the
+/* The GetDC request might not be available (such as occours when the
* NBT server is down). Fallback to a node status. It is the best
* hope we have... */
static void fallback_node_status(struct finddcs_state *state)
@@ -189,7 +191,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.dest_port = state->nbt_port;
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 524391917d..c95d99db54 100644
--- a/source4/libcli/nbt/libnbt.h
+++ b/source4/libcli/nbt/libnbt.h
@@ -186,6 +186,7 @@ struct nbt_name_register_bcast {
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
const char *address;
uint16_t nb_flags;
uint32_t ttl;
@@ -199,6 +200,7 @@ struct nbt_name_register_wins {
struct {
struct nbt_name name;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
uint16_t nb_flags;
uint32_t ttl;
@@ -238,6 +240,7 @@ struct nbt_name_refresh_wins {
struct {
struct nbt_name name;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
uint16_t nb_flags;
uint32_t ttl;
@@ -254,6 +257,7 @@ struct nbt_name_release {
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
const char *address;
uint16_t nb_flags;
bool broadcast;
diff --git a/source4/libcli/nbt/namerefresh.c b/source4/libcli/nbt/namerefresh.c
index 8408b4e3c3..1157c110a1 100644
--- a/source4/libcli/nbt/namerefresh.c
+++ b/source4/libcli/nbt/namerefresh.c
@@ -146,6 +146,7 @@ struct refresh_wins_state {
struct nbt_name_socket *nbtsock;
struct nbt_name_refresh *io;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
int address_idx;
struct nbt_name_request *req;
@@ -174,7 +175,7 @@ static void name_refresh_wins_handler(struct nbt_name_request *req)
goto done;
}
state->io->in.dest_addr = state->wins_servers[0];
- state->io->in.dest_port = lp_nbt_port(global_loadparm);
+ state->io->in.dest_port = state->wins_port;
state->io->in.address = state->addresses[0];
state->req = nbt_name_refresh_send(state->nbtsock, state->io);
if (state->req == NULL) {
@@ -231,6 +232,7 @@ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbt
state->io = talloc(state, struct nbt_name_refresh);
if (state->io == NULL) goto failed;
+ state->wins_port = io->in.wins_port;
state->wins_servers = str_list_copy(state, io->in.wins_servers);
if (state->wins_servers == NULL ||
state->wins_servers[0] == NULL) goto failed;
@@ -241,7 +243,7 @@ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbt
state->io->in.name = io->in.name;
state->io->in.dest_addr = state->wins_servers[0];
- state->io->in.dest_port = lp_nbt_port(global_loadparm);
+ state->io->in.dest_port = state->wins_port;
state->io->in.address = io->in.addresses[0];
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.broadcast = false;
diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c
index 9389981647..3d7ab7f72f 100644
--- a/source4/libcli/nbt/nameregister.c
+++ b/source4/libcli/nbt/nameregister.c
@@ -224,7 +224,7 @@ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *n
state->io->in.name = io->in.name;
state->io->in.dest_addr = io->in.dest_addr;
- state->io->in.dest_port = lp_nbt_port(global_loadparm);
+ state->io->in.dest_port = io->in.dest_port;
state->io->in.address = io->in.address;
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.register_demand = false;
@@ -284,6 +284,7 @@ struct register_wins_state {
struct nbt_name_socket *nbtsock;
struct nbt_name_register *io;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
int address_idx;
struct nbt_name_request *req;
@@ -312,7 +313,7 @@ static void name_register_wins_handler(struct nbt_name_request *req)
goto done;
}
state->io->in.dest_addr = state->wins_servers[0];
- state->io->in.dest_port = lp_nbt_port(global_loadparm);
+ state->io->in.dest_port = state->wins_port;
state->io->in.address = state->addresses[0];
state->req = nbt_name_register_send(state->nbtsock, state->io);
if (state->req == NULL) {
@@ -369,6 +370,7 @@ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nb
state->io = talloc(state, struct nbt_name_register);
if (state->io == NULL) goto failed;
+ state->wins_port = lp_nbt_port(global_loadparm);
state->wins_servers = str_list_copy(state, io->in.wins_servers);
if (state->wins_servers == NULL ||
state->wins_servers[0] == NULL) goto failed;
@@ -379,7 +381,7 @@ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nb
state->io->in.name = io->in.name;
state->io->in.dest_addr = state->wins_servers[0];
- state->io->in.dest_port = lp_nbt_port(global_loadparm);
+ state->io->in.dest_port = state->wins_port;
state->io->in.address = io->in.addresses[0];
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.broadcast = false;
diff --git a/source4/libcli/nbt/namerelease.c b/source4/libcli/nbt/namerelease.c
index 1b3c9ae17e..d735892516 100644
--- a/source4/libcli/nbt/namerelease.c
+++ b/source4/libcli/nbt/namerelease.c
@@ -67,7 +67,7 @@ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
talloc_strdup(packet->additional, io->in.address);
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/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c
index 1f34b4583b..743f2b0f19 100644
--- a/source4/libcli/nbt/nbtsocket.c
+++ b/source4/libcli/nbt/nbtsocket.c
@@ -150,7 +150,7 @@ static void nbt_name_socket_timeout(struct event_context *ev, struct timed_event
-/*
+/**
handle recv events on a nbt name socket
*/
static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)