mirror of
https://github.com/wine-mirror/wine
synced 2024-07-01 07:14:31 +00:00
kerberos: Allocate memory for the output token if requested.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
This commit is contained in:
parent
2c8d4f5abd
commit
7c7702f91d
|
@ -477,7 +477,7 @@ static NTSTATUS NTAPI kerberos_SpInitLsaModeContext( LSA_SEC_HANDLE credential,
|
||||||
{
|
{
|
||||||
static const ULONG supported = ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY | ISC_REQ_SEQUENCE_DETECT |
|
static const ULONG supported = ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY | ISC_REQ_SEQUENCE_DETECT |
|
||||||
ISC_REQ_REPLAY_DETECT | ISC_REQ_MUTUAL_AUTH | ISC_REQ_USE_DCE_STYLE |
|
ISC_REQ_REPLAY_DETECT | ISC_REQ_MUTUAL_AUTH | ISC_REQ_USE_DCE_STYLE |
|
||||||
ISC_REQ_IDENTIFY | ISC_REQ_CONNECTION | ISC_REQ_DELEGATE;
|
ISC_REQ_IDENTIFY | ISC_REQ_CONNECTION | ISC_REQ_DELEGATE | ISC_REQ_ALLOCATE_MEMORY;
|
||||||
char *target = NULL;
|
char *target = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG exptime;
|
ULONG exptime;
|
||||||
|
@ -512,17 +512,41 @@ static NTSTATUS NTAPI kerberos_SpInitLsaModeContext( LSA_SEC_HANDLE credential,
|
||||||
params.input_token_length = input->pBuffers[idx].cbBuffer;
|
params.input_token_length = input->pBuffers[idx].cbBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idx = get_buffer_index( output, SECBUFFER_TOKEN )) == -1) return SEC_E_INVALID_TOKEN;
|
if ((idx = get_buffer_index( output, SECBUFFER_TOKEN )) == -1)
|
||||||
|
{
|
||||||
|
free( target );
|
||||||
|
return SEC_E_INVALID_TOKEN;
|
||||||
|
}
|
||||||
|
if (context_req & ISC_REQ_ALLOCATE_MEMORY)
|
||||||
|
{
|
||||||
|
output->pBuffers[idx].pvBuffer = RtlAllocateHeap( GetProcessHeap(), 0, KERBEROS_MAX_BUF );
|
||||||
|
if (!output->pBuffers[idx].pvBuffer)
|
||||||
|
{
|
||||||
|
free( target );
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
output->pBuffers[idx].cbBuffer = KERBEROS_MAX_BUF;
|
||||||
|
}
|
||||||
params.output_token = output->pBuffers[idx].pvBuffer;
|
params.output_token = output->pBuffers[idx].pvBuffer;
|
||||||
params.output_token_length = &output->pBuffers[idx].cbBuffer;
|
params.output_token_length = &output->pBuffers[idx].cbBuffer;
|
||||||
|
|
||||||
status = KRB5_CALL( initialize_context, ¶ms );
|
status = KRB5_CALL( initialize_context, ¶ms );
|
||||||
if (status == SEC_E_OK || status == SEC_I_CONTINUE_NEEDED)
|
if (status == SEC_E_OK || status == SEC_I_CONTINUE_NEEDED)
|
||||||
*new_context = create_context_handle( context_handle, new_context_handle );
|
|
||||||
if (!status)
|
|
||||||
{
|
{
|
||||||
*mapped_context = TRUE;
|
*new_context = create_context_handle( context_handle, new_context_handle );
|
||||||
expiry_to_timestamp( exptime, expiry );
|
if (context_attr && (context_req & ISC_REQ_ALLOCATE_MEMORY))
|
||||||
|
*context_attr |= ISC_RET_ALLOCATED_MEMORY;
|
||||||
|
|
||||||
|
if (status == SEC_E_OK)
|
||||||
|
{
|
||||||
|
*mapped_context = TRUE;
|
||||||
|
expiry_to_timestamp( exptime, expiry );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (context_req & ISC_REQ_ALLOCATE_MEMORY)
|
||||||
|
RtlFreeHeap( GetProcessHeap(), 0, output->pBuffers[idx].pvBuffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME: initialize context_data */
|
/* FIXME: initialize context_data */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user