From e24b1041b1f6e5b1c5a258a2cbe058f134a45ed9 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Mon, 27 Aug 2012 11:03:25 +0200 Subject: s3:smbd: initialize session->global before calling session_claim Signed-off-by: Stefan Metzmacher Signed-off-by: Michael Adam --- source3/smbd/sesssetup.c | 40 ++++++++++++++++++++-------------------- source3/smbd/smb2_sesssetup.c | 14 +++++++------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'source3') diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index cd7928de505..aad122cbc5a 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -326,15 +326,6 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req) register_homes_share(session_info->unix_info->unix_name); } - if (!session_claim(session)) { - DEBUG(1, ("smb1: Failed to claim session for vuid=%llu\n", - (unsigned long long)session->compat->vuid)); - data_blob_free(&out_blob); - TALLOC_FREE(session); - reply_nterror(req, NT_STATUS_LOGON_FAILURE); - return; - } - if (srv_is_signing_negotiated(sconn) && action == 0 && session->global->signing_key.length > 0) @@ -366,6 +357,15 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req) GENSEC_EXPIRE_TIME_INFINITY; } + if (!session_claim(session)) { + DEBUG(1, ("smb1: Failed to claim session for vuid=%llu\n", + (unsigned long long)session->compat->vuid)); + data_blob_free(&out_blob); + TALLOC_FREE(session); + reply_nterror(req, NT_STATUS_LOGON_FAILURE); + return; + } + status = smbXsrv_session_update(session); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("smb1: Failed to update session for vuid=%llu - %s\n", @@ -1008,17 +1008,6 @@ void reply_sesssetup_and_X(struct smb_request *req) register_homes_share(session_info->unix_info->unix_name); } - if (!session_claim(session)) { - DEBUG(1, ("smb1: Failed to claim session for vuid=%llu\n", - (unsigned long long)session->compat->vuid)); - data_blob_free(&nt_resp); - data_blob_free(&lm_resp); - TALLOC_FREE(session); - reply_nterror(req, NT_STATUS_LOGON_FAILURE); - END_PROFILE(SMBsesssetupX); - return; - } - if (srv_is_signing_negotiated(sconn) && action == 0 && session->global->signing_key.length > 0) @@ -1057,6 +1046,17 @@ void reply_sesssetup_and_X(struct smb_request *req) return; } + if (!session_claim(session)) { + DEBUG(1, ("smb1: Failed to claim session for vuid=%llu\n", + (unsigned long long)session->compat->vuid)); + data_blob_free(&nt_resp); + data_blob_free(&lm_resp); + TALLOC_FREE(session); + reply_nterror(req, NT_STATUS_LOGON_FAILURE); + END_PROFILE(SMBsesssetupX); + return; + } + /* current_user_info is changed on new vuid */ reload_services(sconn, conn_snum_used, true); diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c index 171021a2589..265f8020215 100644 --- a/source3/smbd/smb2_sesssetup.c +++ b/source3/smbd/smb2_sesssetup.c @@ -330,13 +330,6 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbXsrv_session *session, register_homes_share(session_info->unix_info->unix_name); } - if (!session_claim(session)) { - DEBUG(1, ("smb2: Failed to claim session " - "for vuid=%llu\n", - (unsigned long long)session->compat->vuid)); - return NT_STATUS_LOGON_FAILURE; - } - set_current_user_info(session_info->unix_info->sanitized_username, session_info->unix_info->unix_name, session_info->info->domain_name); @@ -350,6 +343,13 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbXsrv_session *session, session->global->auth_session_info_seqnum; session->global->expiration_time = gensec_expire_time(session->gensec); + if (!session_claim(session)) { + DEBUG(1, ("smb2: Failed to claim session " + "for vuid=%llu\n", + (unsigned long long)session->compat->vuid)); + return NT_STATUS_LOGON_FAILURE; + } + status = smbXsrv_session_update(session); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("smb2: Failed to update session for vuid=%llu - %s\n", -- cgit