r26408: Remove use of global_loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 12 Dec 2007 01:15:20 +0000 (02:15 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:49:39 +0000 (05:49 +0100)
16 files changed:
source/libcli/finddcs.c
source/libcli/nbt/libnbt.h
source/libcli/nbt/namerefresh.c
source/libcli/nbt/nameregister.c
source/libcli/nbt/namerelease.c
source/libcli/nbt/nbtsocket.c
source/libnet/libnet_site.c
source/libnet/libnet_site.h
source/nbt_server/register.c
source/nbt_server/wins/winsclient.c
source/nbt_server/wins/winsserver.c
source/nbt_server/wins/winsserver.h
source/nbt_server/wins/winswack.c
source/torture/nbt/wins.c
source/torture/nbt/winsbench.c
source/torture/nbt/winsreplication.c

index 624f6cd630310c1086eaa38d6a1e8e0b3a122dd8..4b7f2dce8ccb43a26e9a87063c05533ebf69db60 100644 (file)
@@ -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;
 
index 524391917d6e7a7d98d821e17d68a6e4c06c3bc0..c95d99db5408b821d3dacd6a8b506ba86c7116d2 100644 (file)
@@ -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;
index 8408b4e3c341b846456024e7d6c6c87e65af850d..1157c110a15213a03ab8cbc3e1ebfa68cfd78722 100644 (file)
@@ -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;
index 9389981647df57a2b8873f812b30360d506036e2..3d7ab7f72fb5e520e7c33f4cd9301466c97d29ce 100644 (file)
@@ -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;
index 1b3c9ae17e909f383ea0f05515bef4a5eaf92a71..d7358925161dfec1065d3f254b2df680c01c5584 100644 (file)
@@ -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);
index 1f34b4583bf8c2b2b762e60eb2d4444ad9ded531..743f2b0f19873136a4df5417a54b55727db04c93 100644 (file)
@@ -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)
index 08cedf0d957de4066ac750893ed81ab4e2b7875f..ab51b5cf3be90a0fe4fe4f25866268b9f1ca1d1f 100644 (file)
@@ -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)) {
index 9a0484c2a998f7c17b33351d45cffd31f255183c..8e607c5b6ae3c7d0be1d1474eaaa775cbc693980 100644 (file)
@@ -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 {
index bde9b1e2db8ab503ac70758e5ce8c2c5b686a2a0..a17d503190404da53c5de1f4d621c6afe3312baf 100644 (file)
@@ -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;
index 046be28515364d024c2756b1af167effb582840f..001ad58f62d559011c823a1ae9f9278f9252e742 100644 (file)
@@ -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;
index 6219e6de680021e64eee1c9887a6e0d946b15285..693e66707850cac837b202049193a47d7eec6024 100644 (file)
@@ -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);
index 15dd4bd3db6f87e2534d020877fce26ef0b63138..edb924c1e3f9c5e9d8d56d38c465897dbf785cf8 100644 (file)
@@ -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;
index 82b16bb20dc899ebef84749ec4f06e10e2ec99a2..6dc90af3171353587e9b48698e1abda111749ec0 100644 (file)
@@ -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;
index a236099a13d8a72503df9a82d68a8a848f64fe23..3107b190757d048fa0389ef61e198bd93e0b2be0 100644 (file)
@@ -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;
index db9371977e38dfa1a49d2125bf3e8d5a5a69e54c..5d7dbaf93e37711a9ac5339793ca78920b0106d9 100644 (file)
@@ -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;
index d1c8e9a961a03852bd50517fed44247ac15c33cf..d96ed3e931e48a9ad39229b244d80ad095ae8fd3 100644 (file)
@@ -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;