mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
auth: Pass in the SMB username (for %U) into generate_session_info
This matches what Samba3 does. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Mon Feb 13 01:25:59 CET 2012 on sn-devel-104
This commit is contained in:
parent
05f9495ff3
commit
caf485a2bd
@ -120,6 +120,7 @@ struct auth4_context {
|
||||
NTSTATUS (*generate_session_info)(TALLOC_CTX *mem_ctx,
|
||||
struct auth4_context *auth_context,
|
||||
void *server_returned_info,
|
||||
const char *original_user_name,
|
||||
uint32_t session_info_flags,
|
||||
struct auth_session_info **session_info);
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
static NTSTATUS auth_generate_session_info_wrapper(TALLOC_CTX *mem_ctx,
|
||||
struct auth4_context *auth_context,
|
||||
void *server_returned_info,
|
||||
uint32_t session_info_flags,
|
||||
const char *original_user_name,
|
||||
uint32_t session_info_flags,
|
||||
struct auth_session_info **session_info);
|
||||
|
||||
/***************************************************************************
|
||||
@ -140,6 +141,7 @@ static NTSTATUS auth_generate_session_info_principal(struct auth4_context *auth_
|
||||
|
||||
nt_status = auth_generate_session_info_wrapper(mem_ctx, auth_ctx,
|
||||
user_info_dc,
|
||||
user_info_dc->info->account_name,
|
||||
session_info_flags, session_info);
|
||||
talloc_free(user_info_dc);
|
||||
|
||||
@ -466,6 +468,7 @@ _PUBLIC_ NTSTATUS auth_check_password_recv(struct tevent_req *req,
|
||||
static NTSTATUS auth_generate_session_info_wrapper(TALLOC_CTX *mem_ctx,
|
||||
struct auth4_context *auth_context,
|
||||
void *server_returned_info,
|
||||
const char *original_user_name,
|
||||
uint32_t session_info_flags,
|
||||
struct auth_session_info **session_info)
|
||||
{
|
||||
@ -494,7 +497,7 @@ static NTSTATUS auth_generate_session_info_wrapper(TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_INVALID_SERVER_STATE;
|
||||
}
|
||||
status = auth_session_info_fill_unix(wbc_ctx, auth_context->lp_ctx,
|
||||
*session_info);
|
||||
original_user_name, *session_info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(*session_info);
|
||||
}
|
||||
@ -542,6 +545,7 @@ static NTSTATUS auth_generate_session_info_pac(struct auth4_context *auth_ctx,
|
||||
|
||||
status = auth_generate_session_info_wrapper(mem_ctx, auth_ctx,
|
||||
user_info_dc,
|
||||
user_info_dc->info->account_name,
|
||||
session_info_flags, session_info);
|
||||
talloc_free(tmp_ctx);
|
||||
return status;
|
||||
|
@ -96,6 +96,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
nt_status = auth_context->generate_session_info(tmp_ctx, auth_context,
|
||||
user_info_dc,
|
||||
nt4_username,
|
||||
flags,
|
||||
session_info);
|
||||
|
||||
|
@ -230,6 +230,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
|
||||
if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info) {
|
||||
nt_status = gensec_security->auth_context->generate_session_info(mem_ctx, gensec_security->auth_context,
|
||||
gensec_ntlmssp->server_returned_info,
|
||||
gensec_ntlmssp->ntlmssp_state->user,
|
||||
session_info_flags,
|
||||
session_info);
|
||||
} else {
|
||||
|
@ -125,8 +125,9 @@ NTSTATUS security_token_to_unix_token(TALLOC_CTX *mem_ctx,
|
||||
/*
|
||||
Fill in the auth_user_info_unix and auth_unix_token elements in a struct session_info
|
||||
*/
|
||||
NTSTATUS auth_session_info_fill_unix( struct wbc_context *wbc_ctx,
|
||||
NTSTATUS auth_session_info_fill_unix(struct wbc_context *wbc_ctx,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const char *original_user_name,
|
||||
struct auth_session_info *session_info)
|
||||
{
|
||||
char *su;
|
||||
@ -149,11 +150,11 @@ NTSTATUS auth_session_info_fill_unix( struct wbc_context *wbc_ctx,
|
||||
session_info->info->account_name);
|
||||
NT_STATUS_HAVE_NO_MEMORY(session_info->unix_info->unix_name);
|
||||
|
||||
len = strlen(session_info->info->account_name) + 1;
|
||||
len = strlen(original_user_name) + 1;
|
||||
session_info->unix_info->sanitized_username = su = talloc_array(session_info->unix_info, char, len);
|
||||
NT_STATUS_HAVE_NO_MEMORY(su);
|
||||
|
||||
alpha_strcpy(su, session_info->info->account_name,
|
||||
alpha_strcpy(su, original_user_name,
|
||||
". _-$", len);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
@ -85,7 +85,8 @@ static void sesssetup_old_send(struct tevent_req *subreq)
|
||||
/* This references user_info_dc into session_info */
|
||||
status = req->smb_conn->negotiate.auth_context->generate_session_info(req,
|
||||
req->smb_conn->negotiate.auth_context,
|
||||
user_info_dc, flags, &session_info);
|
||||
user_info_dc, sess->old.in.user,
|
||||
flags, &session_info);
|
||||
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||
|
||||
/* allocate a new session */
|
||||
@ -217,6 +218,7 @@ static void sesssetup_nt1_send(struct tevent_req *subreq)
|
||||
status = state->auth_context->generate_session_info(req,
|
||||
state->auth_context,
|
||||
user_info_dc,
|
||||
sess->nt1.in.user,
|
||||
flags,
|
||||
&session_info);
|
||||
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||
|
Loading…
Reference in New Issue
Block a user