From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/kerberos/krb5_ap.c | 14 +++++++++++++- dlls/kerberos/unixlib.c | 14 ++++---------- dlls/kerberos/unixlib.h | 5 ++++- 3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/dlls/kerberos/krb5_ap.c b/dlls/kerberos/krb5_ap.c index 5cc2623c4ad..50d58538836 100644 --- a/dlls/kerberos/krb5_ap.c +++ b/dlls/kerberos/krb5_ap.c @@ -641,7 +641,19 @@ static NTSTATUS SEC_ENTRY kerberos_SpMakeSignature( LSA_SEC_HANDLE context, ULON if (context) { struct context_handle *context_handle = (void *)context; - struct make_signature_params params = { context_handle->handle, message }; + struct make_signature_params params; + int data_idx, token_idx; + + /* FIXME: multiple data buffers, read-only buffers */ + if ((data_idx = get_buffer_index( message, SECBUFFER_DATA )) == -1) return SEC_E_INVALID_TOKEN; + if ((token_idx = get_buffer_index( message, SECBUFFER_TOKEN )) == -1) return SEC_E_INVALID_TOKEN; + + params.context = context_handle->handle; + params.data_length = message->pBuffers[data_idx].cbBuffer; + params.data = message->pBuffers[data_idx].pvBuffer; + params.token_length = &message->pBuffers[token_idx].cbBuffer; + params.token = message->pBuffers[token_idx].pvBuffer; + return KRB5_CALL( make_signature, ¶ms ); } else return SEC_E_INVALID_HANDLE; diff --git a/dlls/kerberos/unixlib.c b/dlls/kerberos/unixlib.c index 45d8f0b02da..100a905b066 100644 --- a/dlls/kerberos/unixlib.c +++ b/dlls/kerberos/unixlib.c @@ -753,18 +753,12 @@ static NTSTATUS initialize_context( void *args ) static NTSTATUS make_signature( void *args ) { struct make_signature_params *params = args; - SecBufferDesc *msg = params->msg; OM_uint32 ret, minor_status; gss_buffer_desc data_buffer, token_buffer; gss_ctx_id_t ctx_handle = ctxhandle_sspi_to_gss( params->context ); - int data_idx, token_idx; - - /* FIXME: multiple data buffers, read-only buffers */ - if ((data_idx = get_buffer_index( msg, SECBUFFER_DATA )) == -1) return SEC_E_INVALID_TOKEN; - data_buffer.length = msg->pBuffers[data_idx].cbBuffer; - data_buffer.value = msg->pBuffers[data_idx].pvBuffer;
- if ((token_idx = get_buffer_index( msg, SECBUFFER_TOKEN )) == -1) return SEC_E_INVALID_TOKEN; + data_buffer.length = params->data_length; + data_buffer.value = params->data; token_buffer.length = 0; token_buffer.value = NULL;
@@ -773,8 +767,8 @@ static NTSTATUS make_signature( void *args ) if (GSS_ERROR( ret )) trace_gss_status( ret, minor_status ); if (ret == GSS_S_COMPLETE) { - memcpy( msg->pBuffers[token_idx].pvBuffer, token_buffer.value, token_buffer.length ); - msg->pBuffers[token_idx].cbBuffer = token_buffer.length; + memcpy( params->token, token_buffer.value, token_buffer.length ); + *params->token_length = token_buffer.length; pgss_release_buffer( &minor_status, &token_buffer ); }
diff --git a/dlls/kerberos/unixlib.h b/dlls/kerberos/unixlib.h index 4fada1e1618..b5a058b855c 100644 --- a/dlls/kerberos/unixlib.h +++ b/dlls/kerberos/unixlib.h @@ -72,7 +72,10 @@ struct initialize_context_params struct make_signature_params { UINT64 context; - SecBufferDesc *msg; + BYTE *data; + ULONG data_length; + BYTE *token; + ULONG *token_length; };
struct query_context_attributes_params