From ab69eb8d8901d23794c6a298718e67656ef4820e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:17 +0100 Subject: r26250: Avoid global_loadparm in a couple more places. (This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43) --- source4/auth/auth_anonymous.c | 3 ++- source4/auth/gensec/schannel.c | 2 +- source4/auth/sam.c | 20 ++++++++++++-------- source4/auth/session.c | 12 ++++++++---- 4 files changed, 23 insertions(+), 14 deletions(-) (limited to 'source4/auth') diff --git a/source4/auth/auth_anonymous.c b/source4/auth/auth_anonymous.c index 986fe0e4f5..2dd0be5a04 100644 --- a/source4/auth/auth_anonymous.c +++ b/source4/auth/auth_anonymous.c @@ -21,6 +21,7 @@ #include "includes.h" #include "auth/auth.h" +#include "param/param.h" /** * Return a anonymous logon for anonymous users (username = "") @@ -52,7 +53,7 @@ static NTSTATUS anonymous_check_password(struct auth_method_context *ctx, const struct auth_usersupplied_info *user_info, struct auth_serversupplied_info **_server_info) { - return auth_anonymous_server_info(mem_ctx, _server_info); + return auth_anonymous_server_info(mem_ctx, lp_netbios_name(ctx->auth_ctx->lp_ctx), _server_info); } static struct auth_operations anonymous_auth_ops = { diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index a5e8c60ae3..462fb26ba2 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -183,7 +183,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security, struct auth_session_info **_session_info) { struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state); - return auth_anonymous_session_info(state, _session_info); + return auth_anonymous_session_info(state, global_loadparm, _session_info); } static NTSTATUS schannel_start(struct gensec_security *gensec_security) diff --git a/source4/auth/sam.c b/source4/auth/sam.c index ce02821e83..47d0910650 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -253,10 +253,11 @@ _PUBLIC_ NTSTATUS authsam_account_ok(TALLOC_CTX *mem_ctx, } _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_context *sam_ctx, - struct ldb_message *msg, - struct ldb_message *msg_domain_ref, - DATA_BLOB user_sess_key, DATA_BLOB lm_sess_key, - struct auth_serversupplied_info **_server_info) + const char *netbios_name, + struct ldb_message *msg, + struct ldb_message *msg_domain_ref, + DATA_BLOB user_sess_key, DATA_BLOB lm_sess_key, + struct auth_serversupplied_info **_server_info) { struct auth_serversupplied_info *server_info; struct ldb_message **group_msgs; @@ -345,7 +346,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_conte server_info->home_drive = talloc_strdup(server_info, str); NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive); - server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm)); + server_info->logon_server = talloc_strdup(server_info, netbios_name); NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server); server_info->last_logon = samdb_result_nttime(msg, "lastLogon", 0); @@ -423,7 +424,9 @@ _PUBLIC_ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx, } /* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */ -NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principal, +NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, + const char *principal, struct auth_serversupplied_info **server_info) { NTSTATUS nt_status; @@ -439,7 +442,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principa return NT_STATUS_NO_MEMORY; } - sam_ctx = samdb_connect(tmp_ctx, global_loadparm, system_session(tmp_ctx)); + sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx)); if (sam_ctx == NULL) { talloc_free(tmp_ctx); return NT_STATUS_INVALID_SYSTEM_SERVICE; @@ -451,7 +454,8 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, const char *principa return nt_status; } - nt_status = authsam_make_server_info(tmp_ctx, sam_ctx, msgs[0], msgs_domain_ref[0], + nt_status = authsam_make_server_info(tmp_ctx, sam_ctx, lp_netbios_name(lp_ctx), + msgs[0], msgs_domain_ref[0], user_sess_key, lm_sess_key, server_info); if (NT_STATUS_IS_OK(nt_status)) { diff --git a/source4/auth/session.c b/source4/auth/session.c index 259f52ac5c..0557187199 100644 --- a/source4/auth/session.c +++ b/source4/auth/session.c @@ -33,7 +33,7 @@ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx) { NTSTATUS nt_status; struct auth_session_info *session_info = NULL; - nt_status = auth_anonymous_session_info(mem_ctx, &session_info); + nt_status = auth_anonymous_session_info(mem_ctx, global_loadparm, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { return NULL; } @@ -41,6 +41,7 @@ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx) } NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, + struct loadparm_context *lp_ctx, struct auth_session_info **_session_info) { NTSTATUS nt_status; @@ -49,6 +50,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, TALLOC_CTX *mem_ctx = talloc_new(parent_ctx); nt_status = auth_anonymous_server_info(mem_ctx, + lp_netbios_name(lp_ctx), &server_info); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(mem_ctx); @@ -66,7 +68,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(session_info->credentials, global_loadparm); + cli_credentials_set_conf(session_info->credentials, lp_ctx); cli_credentials_set_anonymous(session_info->credentials); *_session_info = session_info; @@ -74,7 +76,9 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, return NT_STATUS_OK; } -NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info **_server_info) +NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, + const char *netbios_name, + struct auth_serversupplied_info **_server_info) { struct auth_serversupplied_info *server_info; server_info = talloc(mem_ctx, struct auth_serversupplied_info); @@ -122,7 +126,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversuppl server_info->home_drive = talloc_strdup(server_info, ""); NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive); - server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm)); + server_info->logon_server = talloc_strdup(server_info, netbios_name); NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server); server_info->last_logon = 0; -- cgit