mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r26296: Store loadparm context in DCE/RPC server context.
This commit is contained in:
parent
47696b4298
commit
fc1f4d2d65
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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)));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user