From 33582dffcc2d348dc042edfdcccee7500b21d928 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 12 Dec 2007 02:15:20 +0100 Subject: r26408: Remove use of global_loadparm. (This used to be commit f933b4362124bfdd25544b4e27992d9ca4405848) --- source4/libcli/finddcs.c | 6 ++++-- source4/libcli/nbt/libnbt.h | 4 ++++ source4/libcli/nbt/namerefresh.c | 6 ++++-- source4/libcli/nbt/nameregister.c | 8 +++++--- source4/libcli/nbt/namerelease.c | 2 +- source4/libcli/nbt/nbtsocket.c | 2 +- source4/libnet/libnet_site.c | 3 ++- source4/libnet/libnet_site.h | 1 + source4/nbt_server/register.c | 1 + source4/nbt_server/wins/winsclient.c | 1 + source4/nbt_server/wins/winsserver.c | 1 + source4/nbt_server/wins/winsserver.h | 1 + source4/nbt_server/wins/winswack.c | 7 +++++-- source4/torture/nbt/wins.c | 2 ++ source4/torture/nbt/winsbench.c | 3 ++- source4/torture/nbt/winsreplication.c | 3 +++ 16 files changed, 38 insertions(+), 13 deletions(-) (limited to 'source4') 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) diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c index 08cedf0d95..ab51b5cf3b 100644 --- a/source4/libnet/libnet_site.c +++ b/source4/libnet/libnet_site.c @@ -51,7 +51,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r) /* 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; @@ -158,6 +158,7 @@ NTSTATUS libnet_JoinSite(struct ldb_context *remote_ldb, 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)) { diff --git a/source4/libnet/libnet_site.h b/source4/libnet/libnet_site.h index 9a0484c2a9..8e607c5b6a 100644 --- a/source4/libnet/libnet_site.h +++ b/source4/libnet/libnet_site.h @@ -22,6 +22,7 @@ struct libnet_JoinSite { const char *dest_address; const char *netbios_name; const char *domain_dn_str; + uint16_t cldap_port; } in; struct { diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index bde9b1e2db..a17d503190 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -211,6 +211,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, /* 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; diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 046be28515..001ad58f62 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -141,6 +141,7 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, /* 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; diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index 6219e6de68..693e667078 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -378,6 +378,7 @@ static void wins_register_wack(struct nbt_name_socket *nbtsock, 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); diff --git a/source4/nbt_server/wins/winsserver.h b/source4/nbt_server/wins/winsserver.h index 15dd4bd3db..edb924c1e3 100644 --- a/source4/nbt_server/wins/winsserver.h +++ b/source4/nbt_server/wins/winsserver.h @@ -51,6 +51,7 @@ struct wins_server { 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; diff --git a/source4/nbt_server/wins/winswack.c b/source4/nbt_server/wins/winswack.c index 82b16bb20d..6dc90af317 100644 --- a/source4/nbt_server/wins/winswack.c +++ b/source4/nbt_server/wins/winswack.c @@ -47,7 +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_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); @@ -105,7 +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_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; @@ -162,6 +162,7 @@ static void wins_release_demand_handler(struct nbt_name_request *req) 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); @@ -221,6 +222,7 @@ static struct composite_context *wins_release_demand_send(TALLOC_CTX *mem_ctx, s * 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; @@ -303,6 +305,7 @@ NTSTATUS nbtd_proxy_wins_challenge(struct irpc_message *msg, 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; diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index a236099a13..3107b19075 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -80,6 +80,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address 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; @@ -165,6 +166,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address 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; diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c index db9371977e..5d7dbaf93e 100644 --- a/source4/torture/nbt/winsbench.c +++ b/source4/torture/nbt/winsbench.c @@ -87,7 +87,7 @@ static void generate_register(struct nbt_name_socket *nbtsock, struct wins_state 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; @@ -139,6 +139,7 @@ static void generate_release(struct nbt_name_socket *nbtsock, struct wins_state 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; diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index d1c8e9a961..d96ed3e931 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -6562,6 +6562,7 @@ static bool test_conflict_owned_released_vs_replica(struct torture_context *tctx /* 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; @@ -6616,6 +6617,7 @@ static bool test_conflict_owned_released_vs_replica(struct torture_context *tctx } 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; @@ -9368,6 +9370,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx, 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; -- cgit