int num_dcs;
struct nbt_dc_name *dcs;
+ uint16_t nbt_port;
};
static void finddcs_name_resolved(struct composite_context *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;
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)
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;
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
const char *address;
uint16_t nb_flags;
uint32_t ttl;
struct {
struct nbt_name name;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
uint16_t nb_flags;
uint32_t ttl;
struct {
struct nbt_name name;
const char **wins_servers;
+ uint16_t wins_port;
const char **addresses;
uint16_t nb_flags;
uint32_t ttl;
struct {
struct nbt_name name;
const char *dest_addr;
+ uint16_t dest_port;
const char *address;
uint16_t nb_flags;
bool broadcast;
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;
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) {
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;
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;
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;
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;
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) {
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;
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;
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);
-/*
+/**
handle recv events on a nbt name socket
*/
static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
/* Resolve the site name. */
ZERO_STRUCT(search);
search.in.dest_address = r->in.dest_address;
- search.in.dest_port = lp_cldap_port(global_loadparm);
+ search.in.dest_port = r->in.cldap_port;
search.in.acct_control = -1;
search.in.version = 6;
r->in.dest_address = dest_addr;
r->in.netbios_name = libnet_r->in.netbios_name;
r->in.domain_dn_str = libnet_r->out.domain_dn_str;
+ r->in.cldap_port = lp_cldap_port(global_loadparm);
status = libnet_FindSite(tmp_ctx, r);
if (!NT_STATUS_IS_OK(status)) {
const char *dest_address;
const char *netbios_name;
const char *domain_dn_str;
+ uint16_t cldap_port;
} in;
struct {
/* setup a broadcast name registration request */
io.in.name = iname->name;
io.in.dest_addr = iface->bcast_address;
+ io.in.dest_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
io.in.address = iface->ip_address;
io.in.nb_flags = nb_flags;
io.in.ttl = iname->ttl;
/* setup a wins name refresh request */
io.in.name = iname->name;
io.in.wins_servers = str_list_make(tmp_ctx, iname->wins_server, NULL);
+ io.in.wins_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
io.in.addresses = nbtd_address_list(iface, tmp_ctx);
io.in.nb_flags = iname->nb_flags;
io.in.ttl = iname->ttl;
if (talloc_reference(s, src) == NULL) goto failed;
s->io.in.nbtd_server = iface->nbtsrv;
+ s->io.in.nbtd_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx);
s->io.in.event_ctx = iface->nbtsrv->task->event_ctx;
s->io.in.name = rec->name;
s->io.in.num_addresses = winsdb_addr_list_length(rec->addresses);
struct wins_challenge_io {
struct {
struct nbtd_server *nbtd_server;
+ uint16_t nbt_port;
struct event_context *event_ctx;
struct nbt_name *name;
uint32_t num_addresses;
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_port = state->io->in.nbt_port;
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);
/* 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_port = state->io->in.nbt_port;
state->query.in.dest_addr = state->io->in.addresses[state->current_address];
state->query.in.broadcast = false;
state->query.in.wins_lookup = true;
if (state->current_address < state->io->in.num_addresses) {
struct nbtd_interface *iface;
+ state->release.in.dest_port = lp_nbt_port(global_loadparm);
state->release.in.dest_addr = state->io->in.addresses[state->current_address];
state->release.in.address = state->release.in.dest_addr;
state->release.in.timeout = (state->addresses_left > 1 ? 2 : 1);
* with 2 retries
*/
state->release.in.name = *state->io->in.name;
+ state->release.in.dest_port = lp_nbt_port(global_loadparm);
state->release.in.dest_addr = state->io->in.addresses[state->current_address];
state->release.in.address = state->release.in.dest_addr;
state->release.in.broadcast = false;
s->req = req;
s->io.in.nbtd_server = nbtd_server;
+ s->io.in.nbt_port = lp_nbt_port(global_loadparm);
s->io.in.event_ctx = msg->ev;
s->io.in.name = &req->in.name;
s->io.in.num_addresses = req->in.num_addrs;
torture_comment(tctx, "release the name\n");
release.in.name = *name;
+ release.in.dest_port = lp_nbt_port(tctx->lp_ctx);
release.in.dest_addr = address;
release.in.address = myaddress;
release.in.nb_flags = nb_flags;
torture_comment(tctx, "refresh the name\n");
refresh.in.name = *name;
+ refresh.in.wins_port = lp_nbt_port(tctx->lp_ctx);
refresh.in.wins_servers = str_list_make(tctx, address, NULL);
refresh.in.addresses = str_list_make(tctx, myaddress, NULL);
refresh.in.nb_flags = nb_flags;
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.dest_port = state->wins_port;
io.in.address = state->my_ip;
io.in.nb_flags = NBT_NODE_H;
io.in.register_demand = false;
istate->state = state;
io.in.name = generate_name(tmp_ctx, idx);
+ io.in.dest_port = lp_nbt_port(global_loadparm);
io.in.dest_addr = state->wins_server;
io.in.address = state->my_ip;
io.in.nb_flags = NBT_NODE_H;
/* release the record */
release->in.name = records[i].name;
+ release->in.dest_port = lp_nbt_port(tctx->lp_ctx);
release->in.dest_addr = ctx->address;
release->in.address = records[i].wins.ips[0].ip;
release->in.nb_flags = records[i].wins.nb_flags;
} else {
release->in.name = records[i].name;
release->in.dest_addr = ctx->address;
+ release->in.dest_port = lp_nbt_port(tctx->lp_ctx);
release->in.address = records[i].wins.ips[0].ip;
release->in.nb_flags = records[i].wins.nb_flags;
release->in.broadcast = false;
release->in.name = records[i].name;
release->in.dest_addr = ctx->address;
+ release->in.dest_port = lp_nbt_port(tctx->lp_ctx);
release->in.address = records[i].wins.ips[j].ip;
release->in.nb_flags = records[i].wins.nb_flags;
release->in.broadcast = false;