r26328: remove more uses of global_loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 7 Dec 2007 01:37:13 +0000 (02:37 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:48:41 +0000 (05:48 +0100)
(This used to be commit 40ae12c08647c47a9c504d39ee6f61c32b4e5748)

source4/lib/messaging/tests/irpc.c
source4/libnet/libnet.c
source4/libnet/libnet_become_dc.c
source4/libnet/libnet_join.c
source4/libnet/libnet_lookup.c
source4/libnet/libnet_samdump.c
source4/libnet/libnet_samsync_ldb.c
source4/libnet/libnet_unbecome_dc.c
source4/libnet/libnet_vampire.c
source4/rpc_server/samr/dcesrv_samr.c
source4/rpc_server/samr/dcesrv_samr.h

index 28676c21c7293c3be48c4e35fa6d239445a65434..0618adcfb2138fd6c2fda40af47fc61f4e39ce2b 100644 (file)
@@ -226,7 +226,7 @@ static bool irpc_setup(struct torture_context *tctx, void **_data)
 
        torture_assert(tctx, data->msg_ctx2 = 
                       messaging_init(tctx, 
-                                     lp_messaging_path(tctx, global_loadparm),
+                                     lp_messaging_path(tctx, tctx->lp_ctx),
                                      cluster_id(MSG_ID2), data->ev),
                       "Failed to init second messaging context");
 
index 45025992178c729b27ffc1c4ca3c5afd73ec9437..5c483a757c6818702f6f886281d0669aa27a01c9 100644 (file)
@@ -45,7 +45,7 @@ struct libnet_context *libnet_context_init(struct event_context *ev,
        ctx->lp_ctx = lp_ctx;
 
        /* name resolution methods */
-       ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order(global_loadparm));
+       ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order(lp_ctx));
 
        /* connected services' params */
        ZERO_STRUCT(ctx->samr);
index a691fca42088361ba2f418c1c39d257c93494025..4d09422becb661bd67d04e17546b0faa95178947 100644 (file)
@@ -738,7 +738,7 @@ static void becomeDC_send_cldap(struct libnet_BecomeDC_state *s)
        struct cldap_request *req;
 
        s->cldap.io.in.dest_address     = s->source_dsa.address;
-       s->cldap.io.in.dest_port        = lp_cldap_port(global_loadparm);
+       s->cldap.io.in.dest_port        = lp_cldap_port(s->libnet->lp_ctx);
        s->cldap.io.in.realm            = s->domain.dns_name;
        s->cldap.io.in.host             = s->dest_dsa.netbios_name;
        s->cldap.io.in.user             = NULL;
@@ -792,7 +792,7 @@ static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s,
        url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
        NT_STATUS_HAVE_NO_MEMORY(url);
 
-       ldap->ldb = ldb_wrap_connect(s, global_loadparm, url,
+       ldap->ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
                                     NULL,
                                     s->libnet->cred,
                                     0, NULL);
@@ -1513,7 +1513,7 @@ static void becomeDC_drsuapi_connect_send(struct libnet_BecomeDC_state *s,
        drsuapi->s = s;
 
        if (!drsuapi->binding) {
-               if (lp_parm_bool(global_loadparm, NULL, "become_dc", "print", false)) {
+               if (lp_parm_bool(s->libnet->lp_ctx, NULL, "become_dc", "print", false)) {
                        binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[krb5,print,seal]", s->source_dsa.dns_name);
                        if (composite_nomem(binding_str, c)) return;
                } else {
index 2f14799cedc22cca7d5fdbd3f535241628bcfeb5..6d7fcd09adef18ab9de942fac1ca42724ffb3637 100644 (file)
@@ -230,7 +230,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
                return NT_STATUS_NO_MEMORY;
        }
 
-       remote_ldb = ldb_wrap_connect(tmp_ctx, global_loadparm
+       remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->lp_ctx
                                      remote_ldb_url, 
                                      NULL, ctx->cred, 0, NULL);
        if (!remote_ldb) {
@@ -538,8 +538,8 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
                        connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, r->in.domain_name);
                } else {
                        /* Bugger, we just lost our way to automaticly find the domain name */
-                       connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, lp_workgroup(global_loadparm));
-                       connect_with_info->out.realm = talloc_strdup(tmp_ctx, lp_realm(global_loadparm));
+                       connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, lp_workgroup(ctx->lp_ctx));
+                       connect_with_info->out.realm = talloc_strdup(tmp_ctx, lp_realm(ctx->lp_ctx));
                }
        }
 
@@ -891,7 +891,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
        if (r->in.netbios_name != NULL) {
                netbios_name = r->in.netbios_name;
        } else {
-               netbios_name = talloc_reference(tmp_mem, lp_netbios_name(global_loadparm));
+               netbios_name = talloc_reference(tmp_mem, lp_netbios_name(ctx->lp_ctx));
                if (!netbios_name) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -910,7 +910,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
         * Local secrets are stored in secrets.ldb 
         * open it to make sure we can write the info into it after the join
         */
-       ldb = secrets_db_connect(tmp_mem, global_loadparm);
+       ldb = secrets_db_connect(tmp_mem, ctx->lp_ctx);
        if (!ldb) {
                r->out.error_string
                        = talloc_asprintf(mem_ctx, 
index 459e5b1985afac5c2380efb4728278f8505a79c2..5788a56a8823bf77dfa1a54581be627f5f361bd4 100644 (file)
@@ -192,7 +192,7 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
 {
        struct composite_context *c;
        struct messaging_context *msg_ctx = 
-               messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, global_loadparm), ctx->event_ctx);
+               messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, ctx->lp_ctx), ctx->event_ctx);
 
        c = finddcs_send(mem_ctx, io->in.domain_name, io->in.name_type,
                         NULL, ctx->name_res_methods, ctx->event_ctx, msg_ctx);
index 2186271491f4c691b8ac43e2652fdf6d6e53da4c..93e25aa428a8fad2a950437be54de6803eae4b87 100644 (file)
@@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
 
        r2.out.error_string            = NULL;
        r2.in.binding_string           = r->in.binding_string;
-       r2.in.rid_crypt                = lp_parm_bool(global_loadparm, NULL, "vampire", "rid decrypt", true);
+       r2.in.rid_crypt                = lp_parm_bool(ctx->lp_ctx, NULL, "vampire", "rid decrypt", true);
        r2.in.init_fn                  = NULL;
        r2.in.delta_fn                 = libnet_samdump_fn;
        r2.in.fn_ctx                   = samdump_state;
index ea6013391df89125a2fea4ce8d174ec4b6abc594..23cfe630d54a8c73e672f2789b7d1afcf8963ca9 100644 (file)
@@ -1193,7 +1193,7 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx,
                ldap_url = talloc_asprintf(state, "ldap://%s", server);
                
                state->remote_ldb = ldb_wrap_connect(mem_ctx, 
-                                                    global_loadparm
+                                                    state->samsync_state->machine_net_ctx->lp_ctx
                                                     ldap_url, 
                                                     NULL, state->samsync_state->machine_net_ctx->cred,
                                                     0, NULL);
@@ -1221,8 +1221,8 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
        state->trusted_domains = NULL;
 
        state->sam_ldb         = ldb_wrap_connect(mem_ctx, 
-                                                 global_loadparm
-                                                 lp_sam_url(global_loadparm), 
+                                                 ctx->lp_ctx
+                                                 lp_sam_url(ctx->lp_ctx), 
                                                  r->in.session_info,
                                                  ctx->cred, 0, NULL);
 
index a39df4f2544fc8ed318015f107013ca85057ce8b..415912e34dcd2573b832d43d31fbc0f8bfcd1ce3 100644 (file)
@@ -258,7 +258,7 @@ static void unbecomeDC_send_cldap(struct libnet_UnbecomeDC_state *s)
        struct cldap_request *req;
 
        s->cldap.io.in.dest_address     = s->source_dsa.address;
-       s->cldap.io.in.dest_port        = lp_cldap_port(global_loadparm);
+       s->cldap.io.in.dest_port        = lp_cldap_port(s->libnet->lp_ctx);
        s->cldap.io.in.realm            = s->domain.dns_name;
        s->cldap.io.in.host             = s->dest_dsa.netbios_name;
        s->cldap.io.in.user             = NULL;
@@ -309,7 +309,7 @@ static NTSTATUS unbecomeDC_ldap_connect(struct libnet_UnbecomeDC_state *s)
        url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
        NT_STATUS_HAVE_NO_MEMORY(url);
 
-       s->ldap.ldb = ldb_wrap_connect(s, global_loadparm, url,
+       s->ldap.ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
                                       NULL,
                                       s->libnet->cred,
                                       0, NULL);
index e4c883315690faecebc76eee7398e0a9053479d6..574b34c246bf0b5095e449369322c9cfbd34fe17 100644 (file)
@@ -185,7 +185,7 @@ NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx
                        talloc_free(samsync_ctx);
                        return NT_STATUS_NO_MEMORY;
                }
-               cli_credentials_set_conf(machine_account, global_loadparm);
+               cli_credentials_set_conf(machine_account, ctx->lp_ctx);
                nt_status = cli_credentials_set_machine_account(machine_account);
                if (!NT_STATUS_IS_OK(nt_status)) {
                        r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?");
index db659ef5a309b89adecdd161a54171dcef0e6269..03f360125766a3efdee58910a6a43b35188f2b43 100644 (file)
@@ -445,6 +445,7 @@ static NTSTATUS dcesrv_samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLO
                return NT_STATUS_NO_MEMORY;
        }
 
+       d_state->role = lp_server_role(dce_call->conn->dce_ctx->lp_ctx);
        d_state->connect_state = talloc_reference(d_state, c_state);
        d_state->sam_ctx = c_state->sam_ctx;
        d_state->domain_sid = dom_sid_dup(d_state, r->in.sid);
@@ -499,8 +500,6 @@ static NTSTATUS dcesrv_samr_info_DomInfo2(struct samr_domain_state *state,
                                          struct ldb_message **dom_msgs,
                                          struct samr_DomInfo2 *info)
 {
-       enum server_role role = lp_server_role(global_loadparm);
-
        /* This pulls the NetBIOS name from the 
           cn=NTDS Settings,cn=<NETBIOS name of PDC>,....
           string */
@@ -514,7 +513,7 @@ static NTSTATUS dcesrv_samr_info_DomInfo2(struct samr_domain_state *state,
 
        info->sequence_num = ldb_msg_find_attr_as_uint64(dom_msgs[0], "modifiedCount", 
                                                 0);
-       switch (role) {
+       switch (state->role) {
        case ROLE_DOMAIN_CONTROLLER:
                /* This pulls the NetBIOS name from the 
                   cn=NTDS Settings,cn=<NETBIOS name of PDC>,....
@@ -612,9 +611,7 @@ static NTSTATUS dcesrv_samr_info_DomInfo7(struct samr_domain_state *state,
                                   struct samr_DomInfo7 *info)
 {
 
-       enum server_role role = lp_server_role(global_loadparm);
-
-       switch (role) {
+       switch (state->role) {
        case ROLE_DOMAIN_CONTROLLER:
                /* This pulls the NetBIOS name from the 
                   cn=NTDS Settings,cn=<NETBIOS name of PDC>,....
index bc701fb93291427fc7b953052eeb51ec39c0703c..7a6978344be852911ba2342771d8d6886f8e30a8 100644 (file)
@@ -19,6 +19,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "param/param.h"
+
 /*
   this type allows us to distinguish handle types
 */
@@ -49,6 +51,7 @@ struct samr_domain_state {
        struct dom_sid *domain_sid;
        const char *domain_name;
        struct ldb_dn *domain_dn;
+       enum server_role role;
 };
 
 /*