mirror of
https://github.com/samba-team/samba.git
synced 2025-10-21 03:33:16 +03:00
r26228: Store loadparm context in auth context, move more loadparm_contexts up the call stack.
This commit is contained in:
committed by
Stefan Metzmacher
parent
0721a07aad
commit
ba75f1613a
@@ -353,6 +353,7 @@ NTSTATUS auth_check_password_recv(struct auth_check_password_request *req,
|
||||
NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods,
|
||||
struct event_context *ev,
|
||||
struct messaging_context *msg,
|
||||
struct loadparm_context *lp_ctx,
|
||||
struct auth_context **auth_ctx)
|
||||
{
|
||||
int i;
|
||||
@@ -381,6 +382,7 @@ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods,
|
||||
ctx->methods = NULL;
|
||||
ctx->event_ctx = ev;
|
||||
ctx->msg_ctx = msg;
|
||||
ctx->lp_ctx = lp_ctx;
|
||||
|
||||
for (i=0; methods[i] ; i++) {
|
||||
struct auth_method_context *method;
|
||||
@@ -429,7 +431,7 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx,
|
||||
auth_methods = lp_parm_string_list(lp_ctx, NULL, "auth methods", "domain controller", NULL);
|
||||
break;
|
||||
}
|
||||
return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, auth_ctx);
|
||||
return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, lp_ctx, auth_ctx);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -168,6 +168,9 @@ struct auth_context {
|
||||
|
||||
/* the messaging context which can be used by backends */
|
||||
struct messaging_context *msg_ctx;
|
||||
|
||||
/* loadparm context */
|
||||
struct loadparm_context *lp_ctx;
|
||||
};
|
||||
|
||||
/* this structure is used by backends to determine the size of some critical types */
|
||||
|
@@ -151,7 +151,7 @@ static NTSTATUS authsam_password_ok(struct auth_context *auth_context,
|
||||
NTSTATUS status;
|
||||
|
||||
if (acct_flags & ACB_PWNOTREQ) {
|
||||
if (lp_null_passwords(global_loadparm)) {
|
||||
if (lp_null_passwords(auth_context->lp_ctx)) {
|
||||
DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n",
|
||||
user_info->mapped.account_name));
|
||||
return NT_STATUS_OK;
|
||||
@@ -181,6 +181,7 @@ static NTSTATUS authsam_password_ok(struct auth_context *auth_context,
|
||||
*lm_sess_key = data_blob(NULL, 0);
|
||||
*user_sess_key = data_blob(NULL, 0);
|
||||
status = hash_password_check(mem_ctx,
|
||||
auth_context->lp_ctx,
|
||||
user_info->password.hash.lanman,
|
||||
user_info->password.hash.nt,
|
||||
user_info->mapped.account_name,
|
||||
@@ -189,7 +190,9 @@ static NTSTATUS authsam_password_ok(struct auth_context *auth_context,
|
||||
break;
|
||||
|
||||
case AUTH_PASSWORD_RESPONSE:
|
||||
status = ntlm_password_check(mem_ctx, user_info->logon_parameters,
|
||||
status = ntlm_password_check(mem_ctx,
|
||||
auth_context->lp_ctx,
|
||||
user_info->logon_parameters,
|
||||
&auth_context->challenge.data,
|
||||
&user_info->password.response.lanman,
|
||||
&user_info->password.response.nt,
|
||||
@@ -283,7 +286,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
sam_ctx = samdb_connect(tmp_ctx, global_loadparm, system_session(mem_ctx));
|
||||
sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx));
|
||||
if (sam_ctx == NULL) {
|
||||
talloc_free(tmp_ctx);
|
||||
return NT_STATUS_INVALID_SYSTEM_SERVICE;
|
||||
@@ -348,13 +351,13 @@ static NTSTATUS authsam_want_check(struct auth_method_context *ctx,
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
is_local_name = lp_is_myname(global_loadparm,
|
||||
is_local_name = lp_is_myname(ctx->auth_ctx->lp_ctx,
|
||||
user_info->mapped.domain_name);
|
||||
is_my_domain = lp_is_mydomain(global_loadparm,
|
||||
is_my_domain = lp_is_mydomain(ctx->auth_ctx->lp_ctx,
|
||||
user_info->mapped.domain_name);
|
||||
|
||||
/* check whether or not we service this domain/workgroup name */
|
||||
switch (lp_server_role(global_loadparm)) {
|
||||
switch (lp_server_role(ctx->auth_ctx->lp_ctx)) {
|
||||
case ROLE_STANDALONE:
|
||||
return NT_STATUS_OK;
|
||||
|
||||
@@ -390,14 +393,14 @@ static NTSTATUS authsam_check_password(struct auth_method_context *ctx,
|
||||
const char *domain;
|
||||
|
||||
/* check whether or not we service this domain/workgroup name */
|
||||
switch (lp_server_role(global_loadparm)) {
|
||||
switch (lp_server_role(ctx->auth_ctx->lp_ctx)) {
|
||||
case ROLE_STANDALONE:
|
||||
case ROLE_DOMAIN_MEMBER:
|
||||
domain = lp_netbios_name(global_loadparm);
|
||||
domain = lp_netbios_name(ctx->auth_ctx->lp_ctx);
|
||||
break;
|
||||
|
||||
case ROLE_DOMAIN_CONTROLLER:
|
||||
domain = lp_workgroup(global_loadparm);
|
||||
domain = lp_workgroup(ctx->auth_ctx->lp_ctx);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -206,7 +206,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
|
||||
* password file.
|
||||
*/
|
||||
|
||||
if (lp_is_myname(global_loadparm, user_info->domain.str)) {
|
||||
if (lp_is_myname(auth_context->lp_ctx, user_info->domain.str)) {
|
||||
DEBUG(3,("check_smbserver_security: Requested domain was for this machine.\n"));
|
||||
return NT_STATUS_LOGON_FAILURE;
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@
|
||||
_PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
|
||||
struct event_context *ev,
|
||||
struct messaging_context *msg,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const char *nt4_domain,
|
||||
const char *nt4_username,
|
||||
const char *password,
|
||||
@@ -50,7 +51,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
|
||||
|
||||
nt_status = auth_context_create(tmp_ctx,
|
||||
ev, msg,
|
||||
global_loadparm,
|
||||
lp_ctx,
|
||||
&auth_context);
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
talloc_free(tmp_ctx);
|
||||
|
@@ -804,7 +804,7 @@ static NTSTATUS authunix_check_password(struct auth_method_context *ctx,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
nt_status = check_unix_password(check_ctx, global_loadparm, user_info, &pwd);
|
||||
nt_status = check_unix_password(check_ctx, ctx->auth_ctx->lp_ctx, user_info, &pwd);
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
talloc_free(check_ctx);
|
||||
return nt_status;
|
||||
|
@@ -138,8 +138,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_contex
|
||||
}
|
||||
|
||||
chall_blob = data_blob_talloc(mem_ctx, challenge, 8);
|
||||
if (lp_client_ntlmv2_auth(global_loadparm)) {
|
||||
DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
|
||||
if (lp_client_ntlmv2_auth(auth_context->lp_ctx)) {
|
||||
DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(auth_context->lp_ctx), lp_workgroup(auth_context->lp_ctx));
|
||||
DATA_BLOB lmv2_response, ntlmv2_response, lmv2_session_key, ntlmv2_session_key;
|
||||
|
||||
if (!SMBNTLMv2encrypt_hash(user_info_temp,
|
||||
@@ -163,7 +163,7 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth_context *auth_contex
|
||||
SMBOWFencrypt(user_info_in->password.hash.nt->hash, challenge, blob.data);
|
||||
|
||||
user_info_temp->password.response.nt = blob;
|
||||
if (lp_client_lanman_auth(global_loadparm) && user_info_in->password.hash.lanman) {
|
||||
if (lp_client_lanman_auth(auth_context->lp_ctx) && user_info_in->password.hash.lanman) {
|
||||
DATA_BLOB lm_blob = data_blob_talloc(mem_ctx, NULL, 24);
|
||||
SMBOWFencrypt(user_info_in->password.hash.lanman->hash, challenge, blob.data);
|
||||
user_info_temp->password.response.lanman = lm_blob;
|
||||
|
@@ -32,7 +32,7 @@
|
||||
/**
|
||||
connect to the schannel ldb
|
||||
*/
|
||||
struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
|
||||
struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
|
||||
{
|
||||
char *path;
|
||||
struct ldb_context *ldb;
|
||||
@@ -42,14 +42,14 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx)
|
||||
"computerName: CASE_INSENSITIVE\n" \
|
||||
"flatname: CASE_INSENSITIVE\n";
|
||||
|
||||
path = smbd_tmp_path(mem_ctx, global_loadparm, "schannel.ldb");
|
||||
path = smbd_tmp_path(mem_ctx, lp_ctx, "schannel.ldb");
|
||||
if (!path) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
existed = file_exist(path);
|
||||
|
||||
ldb = ldb_wrap_connect(mem_ctx, global_loadparm, path,
|
||||
ldb = ldb_wrap_connect(mem_ctx, lp_ctx, path,
|
||||
system_session(mem_ctx),
|
||||
NULL, LDB_FLG_NOSYNC, NULL);
|
||||
talloc_free(path);
|
||||
@@ -143,7 +143,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
|
||||
NTSTATUS nt_status;
|
||||
int ret;
|
||||
|
||||
ldb = schannel_db_connect(mem_ctx);
|
||||
ldb = schannel_db_connect(mem_ctx, global_loadparm);
|
||||
if (!ldb) {
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
|
||||
NTSTATUS nt_status;
|
||||
struct ldb_context *ldb;
|
||||
|
||||
ldb = schannel_db_connect(mem_ctx);
|
||||
ldb = schannel_db_connect(mem_ctx, global_loadparm);
|
||||
if (!ldb) {
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
@@ -219,6 +219,7 @@ static bool smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
|
||||
*/
|
||||
|
||||
NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct samr_Password *client_lanman,
|
||||
const struct samr_Password *client_nt,
|
||||
const char *username,
|
||||
@@ -240,7 +241,7 @@ NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
} else if (client_lanman && stored_lanman) {
|
||||
if (!lp_lanman_auth(global_loadparm)) {
|
||||
if (!lp_lanman_auth(lp_ctx)) {
|
||||
DEBUG(3,("ntlm_password_check: Interactive logon: only LANMAN password supplied for user %s, and LM passwords are disabled!\n",
|
||||
username));
|
||||
return NT_STATUS_WRONG_PASSWORD;
|
||||
@@ -281,6 +282,7 @@ NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx,
|
||||
*/
|
||||
|
||||
NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
struct loadparm_context *lp_ctx,
|
||||
uint32_t logon_parameters,
|
||||
const DATA_BLOB *challenge,
|
||||
const DATA_BLOB *lm_response,
|
||||
@@ -330,6 +332,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
lm_ok = false;
|
||||
}
|
||||
return hash_password_check(mem_ctx,
|
||||
lp_ctx,
|
||||
lm_ok ? &client_lm : NULL,
|
||||
nt_response->length ? &client_nt : NULL,
|
||||
username,
|
||||
@@ -392,7 +395,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
DEBUG(3,("ntlm_password_check: NTLMv2 password check failed\n"));
|
||||
}
|
||||
} else if (nt_response->length == 24 && stored_nt) {
|
||||
if (lp_ntlm_auth(global_loadparm)) {
|
||||
if (lp_ntlm_auth(lp_ctx)) {
|
||||
/* We have the NT MD4 hash challenge available - see if we can
|
||||
use it (ie. does it exist in the smbpasswd file).
|
||||
*/
|
||||
@@ -404,7 +407,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
/* The LM session key for this response is not very secure,
|
||||
so use it only if we otherwise allow LM authentication */
|
||||
|
||||
if (lp_lanman_auth(global_loadparm) && stored_lanman) {
|
||||
if (lp_lanman_auth(lp_ctx) && stored_lanman) {
|
||||
*lm_sess_key = data_blob_talloc(mem_ctx, stored_lanman->hash, 8);
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
@@ -432,7 +435,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_WRONG_PASSWORD;
|
||||
}
|
||||
|
||||
if (!lp_lanman_auth(global_loadparm)) {
|
||||
if (!lp_lanman_auth(lp_ctx)) {
|
||||
DEBUG(3,("ntlm_password_check: Lanman passwords NOT PERMITTED for user %s\n",
|
||||
username));
|
||||
} else if (!stored_lanman) {
|
||||
@@ -451,7 +454,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
It not very secure, so use it only if we otherwise
|
||||
allow LM authentication */
|
||||
|
||||
if (lp_lanman_auth(global_loadparm) && stored_lanman) {
|
||||
if (lp_lanman_auth(lp_ctx) && stored_lanman) {
|
||||
uint8_t first_8_lm_hash[16];
|
||||
memcpy(first_8_lm_hash, stored_lanman->hash, 8);
|
||||
memset(first_8_lm_hash + 8, '\0', 8);
|
||||
@@ -567,7 +570,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
- I think this is related to Win9X pass-though authentication
|
||||
*/
|
||||
DEBUG(4,("ntlm_password_check: Checking NT MD4 password in LM field\n"));
|
||||
if (lp_ntlm_auth(global_loadparm)) {
|
||||
if (lp_ntlm_auth(lp_ctx)) {
|
||||
if (smb_pwd_check_ntlmv1(mem_ctx,
|
||||
lm_response,
|
||||
stored_nt->hash, challenge,
|
||||
@@ -576,7 +579,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
||||
It not very secure, so use it only if we otherwise
|
||||
allow LM authentication */
|
||||
|
||||
if (lp_lanman_auth(global_loadparm) && stored_lanman) {
|
||||
if (lp_lanman_auth(lp_ctx) && stored_lanman) {
|
||||
uint8_t first_8_lm_hash[16];
|
||||
memcpy(first_8_lm_hash, stored_lanman->hash, 8);
|
||||
memset(first_8_lm_hash + 8, '\0', 8);
|
||||
|
@@ -48,14 +48,14 @@ struct sidmap_context {
|
||||
/*
|
||||
open a sidmap context - use talloc_free to close
|
||||
*/
|
||||
_PUBLIC_ struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx)
|
||||
_PUBLIC_ struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
|
||||
{
|
||||
struct sidmap_context *sidmap;
|
||||
sidmap = talloc(mem_ctx, struct sidmap_context);
|
||||
if (sidmap == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
sidmap->samctx = samdb_connect(sidmap, global_loadparm, system_session(sidmap));
|
||||
sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap));
|
||||
if (sidmap->samctx == NULL) {
|
||||
talloc_free(sidmap);
|
||||
return NULL;
|
||||
|
@@ -45,12 +45,12 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service)
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service)
|
||||
static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct loadparm_context *lp_ctx)
|
||||
{
|
||||
const struct GUID *ntds_guid;
|
||||
struct drsuapi_DsBindInfo28 *bind_info28;
|
||||
|
||||
service->samdb = samdb_connect(service, global_loadparm, service->system_session_info);
|
||||
service->samdb = samdb_connect(service, lp_ctx, service->system_session_info);
|
||||
if (!service->samdb) {
|
||||
return WERR_DS_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ static void dreplsrv_task_init(struct task_server *task)
|
||||
struct dreplsrv_service *service;
|
||||
uint32_t periodic_startup_interval;
|
||||
|
||||
switch (lp_server_role(global_loadparm)) {
|
||||
switch (lp_server_role(task->lp_ctx)) {
|
||||
case ROLE_STANDALONE:
|
||||
task_server_terminate(task, "dreplsrv: no DSDB replication required in standalone configuration");
|
||||
return;
|
||||
@@ -149,7 +149,7 @@ static void dreplsrv_task_init(struct task_server *task)
|
||||
return;
|
||||
}
|
||||
|
||||
status = dreplsrv_connect_samdb(service);
|
||||
status = dreplsrv_connect_samdb(service, task->lp_ctx);
|
||||
if (!W_ERROR_IS_OK(status)) {
|
||||
task_server_terminate(task, talloc_asprintf(task,
|
||||
"dreplsrv: Failed to connect to local samdb: %s\n",
|
||||
@@ -165,8 +165,8 @@ static void dreplsrv_task_init(struct task_server *task)
|
||||
return;
|
||||
}
|
||||
|
||||
periodic_startup_interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */
|
||||
service->periodic.interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */
|
||||
periodic_startup_interval = lp_parm_int(task->lp_ctx, NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */
|
||||
service->periodic.interval = lp_parm_int(task->lp_ctx, NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */
|
||||
|
||||
status = dreplsrv_periodic_schedule(service, periodic_startup_interval);
|
||||
if (!W_ERROR_IS_OK(status)) {
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "dsdb/samdb/samdb.h"
|
||||
#include "auth/gensec/gensec.h"
|
||||
#include "auth/gensec/socket.h"
|
||||
#include "param/param.h"
|
||||
|
||||
static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
|
||||
{
|
||||
@@ -46,7 +47,7 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
|
||||
|
||||
status = crack_auto_name_to_nt4_name(call, req->dn, &nt4_domain, &nt4_account);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
status = authenticate_username_pw(call,
|
||||
status = authenticate_username_pw(global_loadparm, call,
|
||||
call->conn->connection->event.ctx,
|
||||
call->conn->connection->msg_ctx,
|
||||
nt4_domain, nt4_account,
|
||||
|
@@ -389,8 +389,7 @@ static void ldapsrv_accept(struct stream_connection *c)
|
||||
/* Ensure we don't get packets until the database is ready below */
|
||||
packet_recv_disable(conn->packet);
|
||||
|
||||
server_credentials
|
||||
= cli_credentials_init(conn);
|
||||
server_credentials = cli_credentials_init(conn);
|
||||
if (!server_credentials) {
|
||||
stream_terminate_connection(c, "Failed to init server credentials\n");
|
||||
return;
|
||||
@@ -515,7 +514,7 @@ static void ldapsrv_task_init(struct task_server *task)
|
||||
NTSTATUS status;
|
||||
const struct model_ops *model_ops;
|
||||
|
||||
switch (lp_server_role(global_loadparm)) {
|
||||
switch (lp_server_role(task->lp_ctx)) {
|
||||
case ROLE_STANDALONE:
|
||||
task_server_terminate(task, "ldap_server: no LDAP server required in standalone configuration");
|
||||
return;
|
||||
|
@@ -25,15 +25,15 @@
|
||||
#include "lib/dbwrap/dbwrap.h"
|
||||
#include "param/param.h"
|
||||
|
||||
/*
|
||||
/**
|
||||
open a temporary database
|
||||
*/
|
||||
struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
|
||||
struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags)
|
||||
{
|
||||
if (lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false) &&
|
||||
lp_parm_bool(global_loadparm, NULL, "ctdb", name, true)) {
|
||||
if (lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false) &&
|
||||
lp_parm_bool(lp_ctx, NULL, "ctdb", name, true)) {
|
||||
return db_tmp_open_ctdb(mem_ctx, name, tdb_flags);
|
||||
}
|
||||
|
||||
return db_tmp_open_tdb(mem_ctx, name, tdb_flags);
|
||||
return db_tmp_open_tdb(mem_ctx, lp_ctx, name, tdb_flags);
|
||||
}
|
||||
|
@@ -45,9 +45,10 @@ struct db_context {
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
|
||||
struct loadparm_context;
|
||||
struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
|
||||
|
||||
|
||||
/* backends */
|
||||
struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
|
||||
struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
|
||||
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
|
||||
|
@@ -225,7 +225,8 @@ static int db_tdb_get_seqnum(struct db_context *db)
|
||||
/*
|
||||
open a temporary database
|
||||
*/
|
||||
struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
|
||||
struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
const char *name, int tdb_flags)
|
||||
{
|
||||
struct db_context *result;
|
||||
struct db_tdb_ctx *db_tdb;
|
||||
@@ -241,7 +242,7 @@ struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int td
|
||||
|
||||
/* the name passed in should not be a full path, it should be
|
||||
just be the db name */
|
||||
path = smbd_tmp_path(result, global_loadparm, name);
|
||||
path = smbd_tmp_path(result, lp_ctx, name);
|
||||
|
||||
db_tdb->wtdb = tdb_wrap_open(db_tdb, path, 0, tdb_flags,
|
||||
O_CREAT|O_RDWR, 0666);
|
||||
|
@@ -47,7 +47,7 @@ static struct tdb_wrap *cache;
|
||||
* false on failure
|
||||
**/
|
||||
|
||||
bool gencache_init(void)
|
||||
bool gencache_init(struct loadparm_context *lp_ctx)
|
||||
{
|
||||
char* cache_fname = NULL;
|
||||
TALLOC_CTX *mem_ctx = talloc_autofree_context();
|
||||
@@ -55,7 +55,7 @@ bool gencache_init(void)
|
||||
/* skip file open if it's already opened */
|
||||
if (cache) return true;
|
||||
|
||||
cache_fname = lock_path(mem_ctx, global_loadparm, "gencache.tdb");
|
||||
cache_fname = lock_path(mem_ctx, lp_ctx, "gencache.tdb");
|
||||
if (cache_fname != NULL) {
|
||||
DEBUG(5, ("Opening cache file at %s\n", cache_fname));
|
||||
} else {
|
||||
|
@@ -217,6 +217,10 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
|
||||
if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
|
||||
goto failed;
|
||||
}
|
||||
if (ldb_set_opaque(ldb, "loadparm", global_loadparm)) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
|
||||
#endif
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "cluster/cluster.h"
|
||||
#include "ntvfs/common/brlock.h"
|
||||
#include "ntvfs/ntvfs.h"
|
||||
#include "param/param.h"
|
||||
|
||||
/*
|
||||
in this module a "DATA_BLOB *file_key" is a blob that uniquely identifies
|
||||
@@ -94,7 +95,7 @@ static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id se
|
||||
return NULL;
|
||||
}
|
||||
|
||||
brl->db = db_tmp_open(brl, "brlock.tdb", TDB_DEFAULT);
|
||||
brl->db = db_tmp_open(brl, global_loadparm, "brlock.tdb", TDB_DEFAULT);
|
||||
if (brl->db == NULL) {
|
||||
talloc_free(brl);
|
||||
return NULL;
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#include "util/util_ldb.h"
|
||||
#include "libcli/security/security.h"
|
||||
#include "lib/events/events.h"
|
||||
|
||||
#include "param/param.h"
|
||||
|
||||
/*
|
||||
setup config options for a posix share
|
||||
@@ -216,7 +216,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
|
||||
event_context_find(pvfs),
|
||||
pvfs->ntvfs->ctx->config);
|
||||
|
||||
pvfs->sidmap = sidmap_open(pvfs);
|
||||
pvfs->sidmap = sidmap_open(pvfs, global_loadparm);
|
||||
if (pvfs->sidmap == NULL) {
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "auth/auth.h"
|
||||
#include "ntvfs/ntvfs.h"
|
||||
#include "dsdb/samdb/samdb.h"
|
||||
#include "param/param.h"
|
||||
|
||||
struct unixuid_private {
|
||||
struct sidmap_context *sidmap;
|
||||
@@ -215,7 +216,7 @@ static NTSTATUS unixuid_connect(struct ntvfs_module_context *ntvfs,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
private->sidmap = sidmap_open(private);
|
||||
private->sidmap = sidmap_open(private, global_loadparm);
|
||||
if (private->sidmap == NULL) {
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
|
||||
|
||||
partitions_basedn = samdb_partitions_dn(state->sam_ldb, mem_ctx);
|
||||
|
||||
state->sidmap = sidmap_open(state);
|
||||
state->sidmap = sidmap_open(state, global_loadparm);
|
||||
if (state->sidmap == NULL) {
|
||||
return NT_STATUS_INVALID_SYSTEM_SERVICE;
|
||||
}
|
||||
|
@@ -244,7 +244,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(const char *computer_name,
|
||||
struct ldb_context *ldb;
|
||||
int ret;
|
||||
|
||||
ldb = schannel_db_connect(mem_ctx);
|
||||
ldb = schannel_db_connect(mem_ctx, global_loadparm);
|
||||
if (!ldb) {
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "lib/events/events.h"
|
||||
#include "dsdb/samdb/samdb.h"
|
||||
#include "system/passwd.h"
|
||||
#include "param/param.h"
|
||||
|
||||
static NTSTATUS dcesrv_unixinfo_SidToUid(struct dcesrv_call_state *dce_call,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
@@ -35,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);
|
||||
sidmap = sidmap_open(mem_ctx, global_loadparm);
|
||||
if (sidmap == NULL) {
|
||||
DEBUG(10, ("sidmap_open failed\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
@@ -55,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);
|
||||
sidmap = sidmap_open(mem_ctx, global_loadparm);
|
||||
if (sidmap == NULL) {
|
||||
DEBUG(10, ("sidmap_open failed\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
@@ -79,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);
|
||||
sidmap = sidmap_open(mem_ctx, global_loadparm);
|
||||
if (sidmap == NULL) {
|
||||
DEBUG(10, ("sidmap_open failed\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
@@ -99,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);
|
||||
sidmap = sidmap_open(mem_ctx, global_loadparm);
|
||||
if (sidmap == NULL) {
|
||||
DEBUG(10, ("sidmap_open failed\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
|
@@ -60,7 +60,7 @@ static int ejs_doauth(MprVarHandle eid,
|
||||
}
|
||||
|
||||
if (auth_types) {
|
||||
nt_status = auth_context_create_methods(tmp_ctx, auth_types, ev, msg, &auth_context);
|
||||
nt_status = auth_context_create_methods(tmp_ctx, auth_types, ev, msg, global_loadparm, &auth_context);
|
||||
} else {
|
||||
nt_status = auth_context_create(tmp_ctx, ev, msg, global_loadparm, &auth_context);
|
||||
}
|
||||
|
@@ -176,7 +176,8 @@ static bool check_plaintext_auth(const char *user, const char *pass,
|
||||
|
||||
/* authenticate a user with an encrypted username/password */
|
||||
|
||||
static NTSTATUS local_pw_check_specified(const char *username,
|
||||
static NTSTATUS local_pw_check_specified(struct loadparm_context *lp_ctx,
|
||||
const char *username,
|
||||
const char *domain,
|
||||
const char *workstation,
|
||||
const DATA_BLOB *challenge,
|
||||
@@ -206,6 +207,7 @@ static NTSTATUS local_pw_check_specified(const char *username,
|
||||
|
||||
|
||||
nt_status = ntlm_password_check(mem_ctx,
|
||||
lp_ctx,
|
||||
MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT |
|
||||
MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT,
|
||||
challenge,
|
||||
@@ -755,7 +757,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
|
||||
flags |= NTLM_AUTH_FLAG_USER_SESSION_KEY;
|
||||
|
||||
if (!NT_STATUS_IS_OK(
|
||||
local_pw_check_specified(username,
|
||||
local_pw_check_specified(global_loadparm,
|
||||
username,
|
||||
domain,
|
||||
lp_netbios_name(global_loadparm),
|
||||
&challenge,
|
||||
|
Reference in New Issue
Block a user