r26296: Store loadparm context in DCE/RPC server context.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 4 Dec 2007 19:05:00 +0000 (20:05 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:48:13 +0000 (05:48 +0100)
(This used to be commit fc1f4d2d65d4c983cba5421e7ffb64dd75482860)

18 files changed:
source4/ntvfs/ipc/vfs_ipc.c
source4/rpc_server/common/server_info.c
source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcerpc_server.h
source4/rpc_server/dcesrv_auth.c
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/rpc_server/lsa/lsa_init.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/remote/dcesrv_remote.c
source4/rpc_server/samr/dcesrv_samr.c
source4/rpc_server/samr/samr_password.c
source4/rpc_server/service_rpc.c
source4/rpc_server/spoolss/dcesrv_spoolss.c
source4/rpc_server/srvsvc/dcesrv_srvsvc.c
source4/rpc_server/unixinfo/dcesrv_unixinfo.c
source4/rpc_server/winreg/rpc_winreg.c
source4/torture/rpc/spoolss_notify.c

index fc3c74ca6c7fca912395c1177e708f090945932b..4a5ddd7a9cd1a2de7665ea2e35a225fce0533937 100644 (file)
@@ -31,6 +31,7 @@
 #include "ntvfs/ipc/proto.h"
 #include "rpc_server/dcerpc_server.h"
 #include "libcli/raw/ioctl.h"
+#include "param/param.h"
 
 /* this is the private structure used to keep the state of an open
    ipc$ connection. It needs to keep information about all open
@@ -108,7 +109,7 @@ static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
        private->pipe_list = NULL;
 
        /* setup the DCERPC server subsystem */
-       status = dcesrv_init_ipc_context(private, &private->dcesrv);
+       status = dcesrv_init_ipc_context(private, global_loadparm, &private->dcesrv);
        NT_STATUS_NOT_OK_RETURN(status);
 
        return NT_STATUS_OK;
index 6275e35c6c7b0e91246a44624b1c82e64fc02aeb..4a9d3041924e8b711774977220874e1bacac556f 100644 (file)
@@ -36,7 +36,7 @@ _PUBLIC_ enum srvsvc_PlatformId dcesrv_common_get_platform_id(TALLOC_CTX *mem_ct
 {
        enum srvsvc_PlatformId id;
 
-       id = lp_parm_int(global_loadparm, NULL, "server_info", "platform_id", PLATFORM_ID_NT);
+       id = lp_parm_int(dce_ctx->lp_ctx, NULL, "server_info", "platform_id", PLATFORM_ID_NT);
 
        return id;
 }
@@ -47,7 +47,7 @@ _PUBLIC_ const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct d
 
        /* if there's no string return our NETBIOS name */
        if (!p) {
-               return talloc_strdup(mem_ctx, lp_netbios_name(global_loadparm));
+               return talloc_strdup(mem_ctx, lp_netbios_name(dce_ctx->lp_ctx));
        }
 
        /* if there're '\\\\' in front remove them otherwise just pass the string */
@@ -60,25 +60,25 @@ _PUBLIC_ const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct d
 
 const char *dcesrv_common_get_domain_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return talloc_strdup(mem_ctx, lp_workgroup(global_loadparm));
+       return talloc_strdup(mem_ctx, lp_workgroup(dce_ctx->lp_ctx));
 }
 
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_major(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(global_loadparm, NULL, "server_info", "version_major", 5);
+       return lp_parm_int(dce_ctx->lp_ctx, NULL, "server_info", "version_major", 5);
 }
 
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_minor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(global_loadparm, NULL, "server_info", "version_minor", 2);
+       return lp_parm_int(dce_ctx->lp_ctx, NULL, "server_info", "version_minor", 2);
 }
 
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(global_loadparm, NULL, "server_info", "version_build", 3790);
+       return lp_parm_int(dce_ctx->lp_ctx, NULL, "server_info", "version_build", 3790);
 }
 
 /* This hardcoded value should go into a ldb database! */
@@ -89,7 +89,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces
        default_server_announce |= SV_TYPE_SERVER;
        default_server_announce |= SV_TYPE_SERVER_UNIX;
 
-       switch (lp_announce_as(global_loadparm)) {
+       switch (lp_announce_as(dce_ctx->lp_ctx)) {
                case ANNOUNCE_AS_NT_SERVER:
                        default_server_announce |= SV_TYPE_SERVER_NT;
                        /* fall through... */
@@ -106,7 +106,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces
                        break;
        }
 
-       switch (lp_server_role(global_loadparm)) {
+       switch (lp_server_role(dce_ctx->lp_ctx)) {
                case ROLE_DOMAIN_MEMBER:
                        default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
                        break;
@@ -118,7 +118,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces
                                break;
                        }
                        /* open main ldb */
-                       samctx = samdb_connect(tmp_ctx, global_loadparm, anonymous_session(tmp_ctx, global_loadparm));
+                       samctx = samdb_connect(tmp_ctx, global_loadparm, anonymous_session(tmp_ctx, dce_ctx->lp_ctx));
                        if (samctx == NULL) {
                                DEBUG(2,("Unable to open samdb in determining server announce flags\n"));
                        } else {
@@ -138,10 +138,10 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces
                default:
                        break;
        }
-       if (lp_time_server(global_loadparm))
+       if (lp_time_server(dce_ctx->lp_ctx))
                default_server_announce |= SV_TYPE_TIME_SOURCE;
 
-       if (lp_host_msdfs(global_loadparm))
+       if (lp_host_msdfs(dce_ctx->lp_ctx))
                default_server_announce |= SV_TYPE_DFS_SERVER;
 
 
index e146509b67c22811c0a81010f953ed301bc3b25c..f5576c5a6c75a375f87b8a19f5c71af3c241a184 100644 (file)
@@ -386,11 +386,11 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx,
 }
 
 
-static void dcesrv_init_hdr(struct ncacn_packet *pkt)
+static void dcesrv_init_hdr(struct ncacn_packet *pkt, bool bigendian)
 {
        pkt->rpc_vers = 5;
        pkt->rpc_vers_minor = 0;
-       if (lp_rpc_big_endian(global_loadparm)) {
+       if (bigendian) {
                pkt->drep[0] = 0;
        } else {
                pkt->drep[0] = DCERPC_DREP_LE;
@@ -447,7 +447,7 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code
        NTSTATUS status;
 
        /* setup a bind_ack */
-       dcesrv_init_hdr(&pkt);
+       dcesrv_init_hdr(&pkt, lp_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
        pkt.auth_length = 0;
        pkt.call_id = call->pkt.call_id;
        pkt.ptype = DCERPC_PKT_FAULT;
@@ -486,7 +486,7 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason)
        NTSTATUS status;
 
        /* setup a bind_nak */
-       dcesrv_init_hdr(&pkt);
+       dcesrv_init_hdr(&pkt, lp_rpc_big_endian(global_loadparm));
        pkt.auth_length = 0;
        pkt.call_id = call->pkt.call_id;
        pkt.ptype = DCERPC_PKT_BIND_NAK;
@@ -596,7 +596,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
        }
 
        /* setup a bind_ack */
-       dcesrv_init_hdr(&pkt);
+       dcesrv_init_hdr(&pkt, lp_rpc_big_endian(global_loadparm));
        pkt.auth_length = 0;
        pkt.call_id = call->pkt.call_id;
        pkt.ptype = DCERPC_PKT_BIND_ACK;
@@ -752,7 +752,7 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
        }
 
        /* setup a alter_resp */
-       dcesrv_init_hdr(&pkt);
+       dcesrv_init_hdr(&pkt, lp_rpc_big_endian(global_loadparm));
        pkt.auth_length = 0;
        pkt.call_id = call->pkt.call_id;
        pkt.ptype = DCERPC_PKT_ALTER_RESP;
@@ -892,7 +892,7 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
           pointers */
        push->ptr_count = call->ndr_pull->ptr_count;
 
-       if (lp_rpc_big_endian(global_loadparm)) {
+       if (lp_rpc_big_endian(call->conn->dce_ctx->lp_ctx)) {
                push->flags |= LIBNDR_FLAG_BIGENDIAN;
        }
 
@@ -921,7 +921,7 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
                }
 
                /* form the dcerpc response packet */
-               dcesrv_init_hdr(&pkt);
+               dcesrv_init_hdr(&pkt, lp_rpc_big_endian(call->conn->dce_ctx->lp_ctx));
                pkt.auth_length = 0;
                pkt.call_id = call->pkt.call_id;
                pkt.ptype = DCERPC_PKT_RESPONSE;
@@ -1248,7 +1248,9 @@ _PUBLIC_ NTSTATUS dcesrv_output(struct dcesrv_connection *dce_conn,
        return status;
 }
 
-_PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, const char **endpoint_servers, struct dcesrv_context **_dce_ctx)
+_PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, 
+                                     struct loadparm_context *lp_ctx,
+                                     const char **endpoint_servers, struct dcesrv_context **_dce_ctx)
 {
        NTSTATUS status;
        struct dcesrv_context *dce_ctx;
@@ -1262,6 +1264,7 @@ _PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, const char **endpoint
        dce_ctx = talloc(mem_ctx, struct dcesrv_context);
        NT_STATUS_HAVE_NO_MEMORY(dce_ctx);
        dce_ctx->endpoint_list  = NULL;
+       dce_ctx->lp_ctx = lp_ctx;
 
        for (i=0;endpoint_servers[i];i++) {
                const struct dcesrv_endpoint_server *ep_server;
@@ -1368,12 +1371,13 @@ const struct dcesrv_critical_sizes *dcerpc_module_version(void)
 /*
   initialise the dcerpc server context for ncacn_np based services
 */
-_PUBLIC_ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct dcesrv_context **_dce_ctx)
+_PUBLIC_ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+                                         struct dcesrv_context **_dce_ctx)
 {
        NTSTATUS status;
        struct dcesrv_context *dce_ctx;
 
-       status = dcesrv_init_context(mem_ctx, lp_dcerpc_endpoint_servers(global_loadparm), &dce_ctx);
+       status = dcesrv_init_context(mem_ctx, lp_ctx, lp_dcerpc_endpoint_servers(lp_ctx), &dce_ctx);
        NT_STATUS_NOT_OK_RETURN(status);
 
        *_dce_ctx = dce_ctx;
index f9a0f00288dcd6b4e0cb30f16bf3999b84d1717b..5d4accc538f9b64bfa49acc421b0188130cef462 100644 (file)
@@ -261,6 +261,9 @@ struct dcesrv_context {
                        struct dcesrv_interface iface;
                } *interface_list;
        } *endpoint_list;
+
+       /* loadparm context to use for this connection */
+       struct loadparm_context *lp_ctx;
 };
 
 /* this structure is used by modules to determine the size of some critical types */
index 4656b1d49c44394745f51be2c2deee4d23397f47..fa724a072664923989fe8f5b472eafe1bcb74ce0 100644 (file)
@@ -59,7 +59,7 @@ bool dcesrv_auth_bind(struct dcesrv_call_state *call)
                return false;
        }
 
-       status = gensec_server_start(dce_conn, call->event_ctx, global_loadparm, call->msg_ctx, &auth->gensec_security);
+       status = gensec_server_start(dce_conn, call->event_ctx, call->conn->dce_ctx->lp_ctx, call->msg_ctx, &auth->gensec_security);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("Failed to start GENSEC for DCERPC server: %s\n", nt_errstr(status)));
                return false;
@@ -72,7 +72,7 @@ bool dcesrv_auth_bind(struct dcesrv_call_state *call)
                return false;
        }
        
-       cli_credentials_set_conf(server_credentials, global_loadparm);
+       cli_credentials_set_conf(server_credentials, call->conn->dce_ctx->lp_ctx);
        status = cli_credentials_set_machine_account(server_credentials);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status)));
index cf2d2599071a9b52c995dccd4c980ece130b2ebe..a97b93a051a3bae29fb6931968f6843ca9091cf6 100644 (file)
@@ -58,7 +58,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
        /*
         * connect to the samdb
         */
-       b_state->sam_ctx = samdb_connect(b_state, global_loadparm, dce_call->conn->auth_state.session_info); 
+       b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (!b_state->sam_ctx) {
                return WERR_FOOBAR;
        }
index 9d1f43a21473c16fd430afb2ca4c0649ba514c3d..e054aaeffe2a6355f3bd1ec7fbd0de64fac0dbb2 100644 (file)
@@ -264,7 +264,7 @@ static WERROR dcesrv_dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_cal
 
                ZERO_STRUCT(domain_guid);
 
-               switch (lp_server_role(global_loadparm)) {
+               switch (lp_server_role(dce_call->conn->dce_ctx->lp_ctx)) {
                case ROLE_STANDALONE:
                        role            = DS_ROLE_STANDALONE_SERVER;
                        break;
@@ -280,13 +280,13 @@ static WERROR dcesrv_dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_cal
                        break;
                }
 
-               switch (lp_server_role(global_loadparm)) {
+               switch (lp_server_role(dce_call->conn->dce_ctx->lp_ctx)) {
                case ROLE_STANDALONE:
-                       domain          = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm));
+                       domain          = talloc_strdup(mem_ctx, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx));
                        W_ERROR_HAVE_NO_MEMORY(domain);
                        break;
                case ROLE_DOMAIN_MEMBER:
-                       domain          = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm));
+                       domain          = talloc_strdup(mem_ctx, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx));
                        W_ERROR_HAVE_NO_MEMORY(domain);
                        /* TODO: what is with dns_domain and forest and guid? */
                        break;
@@ -1713,8 +1713,8 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
                        return NT_STATUS_INVALID_PARAMETER;
                }
 
-               secret_state->sam_ldb = talloc_reference(secret_state, secrets_db_connect(mem_ctx, 
-                                                                                         global_loadparm));
+               secret_state->sam_ldb = talloc_reference(secret_state, 
+                                                        secrets_db_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
                /* search for the secret record */
                ret = gendb_search(secret_state->sam_ldb, mem_ctx,
                                   ldb_dn_new(mem_ctx, secret_state->sam_ldb, "cn=LSA Secrets"),
@@ -1833,7 +1833,7 @@ static NTSTATUS dcesrv_lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC
        
        } else {
                secret_state->sam_ldb = talloc_reference(secret_state, 
-                                                        secrets_db_connect(mem_ctx, global_loadparm));
+                                secrets_db_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
 
                secret_state->global = false;
                name = r->in.name.string;
index c86fdf333d321b23775e5760609552985569a960..57599b96a22552d1e0f5d929acbf5ae04c1b56f6 100644 (file)
@@ -50,14 +50,14 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
        }
 
        /* make sure the sam database is accessible */
-       state->sam_ldb = samdb_connect(state, global_loadparm, dce_call->conn->auth_state.session_info); 
+       state->sam_ldb = samdb_connect(state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (state->sam_ldb == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
 
        partitions_basedn = samdb_partitions_dn(state->sam_ldb, mem_ctx);
 
-       state->sidmap = sidmap_open(state, global_loadparm);
+       state->sidmap = sidmap_open(state, dce_call->conn->dce_ctx->lp_ctx);
        if (state->sidmap == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index a6e955178d225734c6921c708a6c3c5f952c5e76..d51f9e218d8dad66d6b9bb6ff3c941c6b4644036 100644 (file)
@@ -92,7 +92,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, global_loadparm));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -165,7 +165,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
        creds->account_name = talloc_steal(creds, r->in.account_name);
        
        creds->computer_name = talloc_steal(creds, r->in.computer_name);
-       creds->domain = talloc_strdup(creds, lp_workgroup(global_loadparm));
+       creds->domain = talloc_strdup(creds, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx));
 
        creds->secure_channel_type = r->in.secure_channel_type;
 
@@ -173,7 +173,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
 
 
        /* remember this session key state */
-       nt_status = schannel_store_session_key(mem_ctx, global_loadparm, creds);
+       nt_status = schannel_store_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, creds);
 
        return nt_status;
 }
@@ -301,7 +301,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
                                                 &creds);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -339,7 +339,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
                                                 &creds);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -432,7 +432,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal
                /* TODO: we need to deny anonymous access here */
                nt_status = auth_context_create(mem_ctx, 
                                                dce_call->event_ctx, dce_call->msg_ctx,
-                                               global_loadparm,
+                                               dce_call->conn->dce_ctx->lp_ctx,
                                                &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
@@ -459,7 +459,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal
                /* TODO: we need to deny anonymous access here */
                nt_status = auth_context_create(mem_ctx, 
                                                dce_call->event_ctx, dce_call->msg_ctx,
-                                               global_loadparm,
+                                               dce_call->conn->dce_ctx->lp_ctx,
                                                &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
@@ -531,7 +531,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal
                sam6 = talloc_zero(mem_ctx, struct netr_SamInfo6);
                NT_STATUS_HAVE_NO_MEMORY(sam6);
                sam6->base = *sam;
-               sam6->forest.string = lp_realm(global_loadparm);
+               sam6->forest.string = lp_realm(dce_call->conn->dce_ctx->lp_ctx);
                sam6->principle.string = talloc_asprintf(mem_ctx, "%s@%s", 
                                                         sam->account_name.string, sam6->forest.string);
                NT_STATUS_HAVE_NO_MEMORY(sam6->principle.string);
@@ -555,7 +555,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call,
 {
        NTSTATUS nt_status;
        struct creds_CredentialState *creds;
-       nt_status = schannel_fetch_session_key(mem_ctx, global_loadparm, r->in.computer_name, lp_workgroup(global_loadparm), &creds);
+       nt_status = schannel_fetch_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds);
        if (!NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
        }
@@ -885,7 +885,7 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
                                              NULL);
        NT_STATUS_NOT_OK_RETURN(status);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -989,7 +989,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
 
        ZERO_STRUCT(r->out);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return WERR_DS_SERVICE_UNAVAILABLE;
        }
@@ -1008,8 +1008,8 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
         *       - check all r->in.* parameters (server_unc is ignored by w2k3!)
         */
        r->out.info->dc_unc             = talloc_asprintf(mem_ctx, "\\\\%s.%s", 
-                                                         lp_netbios_name(global_loadparm), 
-                                                         lp_realm(global_loadparm));
+                                                         lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx), 
+                                                         lp_realm(dce_call->conn->dce_ctx->lp_ctx));
        W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_unc);
        r->out.info->dc_address         = talloc_strdup(mem_ctx, "\\\\0.0.0.0");
        W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_address);
@@ -1147,7 +1147,7 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
 
        ZERO_STRUCT(r->out);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return WERR_GENERAL_FAILURE;
        }
index f91334510c5fc71dbfb210b62eb04f6cc411b727..613b53519af6cf3e8a4e6f004cab79bdceedd23b 100644 (file)
@@ -40,12 +40,12 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
         NTSTATUS status;
        const struct ndr_interface_table *table;
         struct dcesrv_remote_private *private;
-       const char *binding = lp_parm_string(global_loadparm, NULL, "dcerpc_remote", "binding");
+       const char *binding = lp_parm_string(dce_call->conn->dce_ctx->lp_ctx, NULL, "dcerpc_remote", "binding");
        const char *user, *pass, *domain;
        struct cli_credentials *credentials;
        bool machine_account;
 
-       machine_account = lp_parm_bool(global_loadparm, NULL, "dcerpc_remote", "use_machine_account", false);
+       machine_account = lp_parm_bool(dce_call->conn->dce_ctx->lp_ctx, NULL, "dcerpc_remote", "use_machine_account", false);
 
        private = talloc(dce_call->conn, struct dcesrv_remote_private);
        if (!private) {
@@ -60,9 +60,9 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       user = lp_parm_string(global_loadparm, NULL, "dcerpc_remote", "user");
-       pass = lp_parm_string(global_loadparm, NULL, "dcerpc_remote", "password");
-       domain = lp_parm_string(global_loadparm, NULL, "dceprc_remote", "domain");
+       user = lp_parm_string(dce_call->conn->dce_ctx->lp_ctx, NULL, "dcerpc_remote", "user");
+       pass = lp_parm_string(dce_call->conn->dce_ctx->lp_ctx, NULL, "dcerpc_remote", "password");
+       domain = lp_parm_string(dce_call->conn->dce_ctx->lp_ctx, NULL, "dceprc_remote", "domain");
 
        table = ndr_table_by_uuid(&iface->syntax_id.uuid); /* FIXME: What about if_version ? */
        if (!table) {
@@ -76,7 +76,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
                if (!credentials) {
                        return NT_STATUS_NO_MEMORY;
                }
-               cli_credentials_set_conf(credentials, global_loadparm);
+               cli_credentials_set_conf(credentials, dce_call->conn->dce_ctx->lp_ctx);
                cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
                if (domain) {
                        cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
@@ -85,7 +85,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
        } else if (machine_account) {
                DEBUG(5, ("dcerpc_remote: RPC Proxy: Using machine account\n"));
                credentials = cli_credentials_init(private);
-               cli_credentials_set_conf(credentials, global_loadparm);
+               cli_credentials_set_conf(credentials, dce_call->conn->dce_ctx->lp_ctx);
                if (domain) {
                        cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
                }
@@ -224,7 +224,7 @@ static NTSTATUS remote_register_one_iface(struct dcesrv_context *dce_ctx, const
 static NTSTATUS remote_op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 {
        int i;
-       const char **ifaces = str_list_make(dce_ctx, lp_parm_string(global_loadparm, NULL, "dcerpc_remote", "interfaces"),NULL);
+       const char **ifaces = str_list_make(dce_ctx, lp_parm_string(dce_ctx->lp_ctx, NULL, "dcerpc_remote", "interfaces"),NULL);
 
        if (!ifaces) {
                DEBUG(3,("remote_op_init_server: no interfaces configured\n"));
index 5d83ba84a7357350ae194ea060076604d1499fde..dcb1554740b57b8831d30bcfd286a7d33383a4f9 100644 (file)
@@ -141,7 +141,7 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C
        }
 
        /* make sure the sam database is accessible */
-       c_state->sam_ctx = samdb_connect(c_state, global_loadparm, dce_call->conn->auth_state.session_info); 
+       c_state->sam_ctx = samdb_connect(c_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (c_state->sam_ctx == NULL) {
                talloc_free(c_state);
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -4086,7 +4086,7 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
 
        ZERO_STRUCT(r->out.info);
 
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, dce_call->conn->auth_state.session_info); 
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index ccd99075142db84859fd8352fb7b0d6aca59fa47..ec91b8eadaf5491ad060becc18c2fb8ecd1d6fac 100644 (file)
@@ -66,7 +66,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -205,7 +205,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -343,7 +343,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, global_loadparm, system_session(mem_ctx, global_loadparm));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index e327a3e4b4aef0de1a51c792b652456c7f0a72d7..e5ed3bd0cf266218d9b696450df9b36486b57a6d 100644 (file)
@@ -424,6 +424,7 @@ static void dcesrv_task_init(struct task_server *task)
        task_server_set_title(task, "task[dcesrv]");
 
        status = dcesrv_init_context(task->event_ctx,
+                                    task->lp_ctx,
                                     lp_dcerpc_endpoint_servers(task->lp_ctx),
                                     &dce_ctx);
        if (!NT_STATUS_IS_OK(status)) goto failed;
@@ -466,5 +467,3 @@ NTSTATUS server_service_rpc_init(void)
        
        return register_server_service("rpc", dcesrv_init);
 }
-
-
index 09409b15149984187a8e1ecf72998e9cfee65142..bd30f231bf17e707fb5558111750d4ac81be3b66 100644 (file)
@@ -174,10 +174,10 @@ static WERROR dcesrv_spoolss_check_server_name(struct dcesrv_call_state *dce_cal
        server_name += 2;
 
        /* NETBIOS NAME is ok */
-       ret = strequal(lp_netbios_name(global_loadparm), server_name);
+       ret = strequal(lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx), server_name);
        if (ret) return WERR_OK;
 
-       aliases = lp_netbios_aliases(global_loadparm);
+       aliases = lp_netbios_aliases(dce_call->conn->dce_ctx->lp_ctx);
 
        for (i=0; aliases && aliases[i]; i++) {
                if (strequal(aliases[i], server_name)) {
@@ -188,12 +188,12 @@ static WERROR dcesrv_spoolss_check_server_name(struct dcesrv_call_state *dce_cal
        /* DNS NAME is ok
         * TODO: we need to check if aliases are also ok
         */
-       if (lp_realm(global_loadparm)) {
+       if (lp_realm(dce_call->conn->dce_ctx->lp_ctx)) {
                char *str;
 
                str = talloc_asprintf(mem_ctx, "%s.%s",
-                                               lp_netbios_name(global_loadparm),
-                                               lp_realm(global_loadparm));
+                                               lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx),
+                                               lp_realm(dce_call->conn->dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(str);
 
                ret = strequal(str, server_name);
@@ -216,7 +216,7 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st
        NTSTATUS status;
        struct ntptr_context *ntptr;
 
-       status = ntptr_init_context(dce_call->context, lp_ntptr_providor(global_loadparm), &ntptr);
+       status = ntptr_init_context(dce_call->context, lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
        NT_STATUS_NOT_OK_RETURN(status);
 
        dce_call->context->private = ntptr;
@@ -1163,7 +1163,7 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_
        }
 
        ZERO_STRUCT(rop);
-       rop.in.server_name = lp_netbios_name(global_loadparm);
+       rop.in.server_name = lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx);
        W_ERROR_HAVE_NO_MEMORY(rop.in.server_name);
        rop.in.printer_local = 0;
        rop.in.type = REG_NONE;
index aee88d915ccf927d9b46465587468945d3aa5b19..d76e83ba17adae1bdc62894739865ee5d09fafa7 100644 (file)
@@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
                info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
                info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
                info101->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
-               info101->comment        = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm));
+               info101->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info101->comment);
 
                r->out.info.info101 = info101;
@@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
                info102->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx);
                info102->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx);
                info102->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
-               info102->comment        = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm));
+               info102->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info102->comment);
 
                info102->users          = dcesrv_common_get_users(mem_ctx, dce_ctx);
index 290cfda640c8872d41b9dc23cbbd6c5adc2319d9..2c08d501d16de8dc358bab62523d2e247c66f0e5 100644 (file)
@@ -36,7 +36,7 @@ static NTSTATUS dcesrv_unixinfo_SidToUid(struct dcesrv_call_state *dce_call,
        struct sidmap_context *sidmap;
        uid_t uid;
 
-       sidmap = sidmap_open(mem_ctx, global_loadparm);
+       sidmap = sidmap_open(mem_ctx, dce_call->conn->dce_ctx->lp_ctx);
        if (sidmap == NULL) {
                DEBUG(10, ("sidmap_open failed\n"));
                return NT_STATUS_NO_MEMORY;
@@ -56,7 +56,7 @@ static NTSTATUS dcesrv_unixinfo_UidToSid(struct dcesrv_call_state *dce_call,
        struct sidmap_context *sidmap;
        uid_t uid;
 
-       sidmap = sidmap_open(mem_ctx, global_loadparm);
+       sidmap = sidmap_open(mem_ctx, dce_call->conn->dce_ctx->lp_ctx);
        if (sidmap == NULL) {
                DEBUG(10, ("sidmap_open failed\n"));
                return NT_STATUS_NO_MEMORY;
@@ -80,7 +80,7 @@ static NTSTATUS dcesrv_unixinfo_SidToGid(struct dcesrv_call_state *dce_call,
        struct sidmap_context *sidmap;
        gid_t gid;
 
-       sidmap = sidmap_open(mem_ctx, global_loadparm);
+       sidmap = sidmap_open(mem_ctx, dce_call->conn->dce_ctx->lp_ctx);
        if (sidmap == NULL) {
                DEBUG(10, ("sidmap_open failed\n"));
                return NT_STATUS_NO_MEMORY;
@@ -100,7 +100,7 @@ static NTSTATUS dcesrv_unixinfo_GidToSid(struct dcesrv_call_state *dce_call,
        struct sidmap_context *sidmap;
        gid_t gid;
 
-       sidmap = sidmap_open(mem_ctx, global_loadparm);
+       sidmap = sidmap_open(mem_ctx, dce_call->conn->dce_ctx->lp_ctx);
        if (sidmap == NULL) {
                DEBUG(10, ("sidmap_open failed\n"));
                return NT_STATUS_NO_MEMORY;
index 80f3851eb86fa56cc91ede320f97457fdbda4093..7fdd9b0413283588e5d8184753ee1d3f9591c006 100644 (file)
@@ -36,7 +36,7 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call,
        WERROR err;
 
        err = reg_open_samba(dce_call->context,
-                            &ctx, global_loadparm, dce_call->conn->auth_state.session_info,
+                            &ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info,
                             NULL);
 
        if (!W_ERROR_IS_OK(err)) {
index c39294e4312df2b88873f2749e2ca1abae1acbee..b211e3aa57e0a2fe496e64e1c78658142dff99a3 100644 (file)
@@ -231,7 +231,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
        status = smbsrv_add_socket(p->conn->event_ctx, tctx->lp_ctx, &single_ops, address);
        torture_assert_ntstatus_ok(tctx, status, "starting smb server");
 
-       status = dcesrv_init_context(tctx, endpoints, &dce_ctx);
+       status = dcesrv_init_context(tctx, tctx->lp_ctx, endpoints, &dce_ctx);
        torture_assert_ntstatus_ok(tctx, status, 
                                   "unable to initialize DCE/RPC server");