kerberos: Move support for SpMakeSignature to the Unix library.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e6aa95c08a
commit
712dfa4660
|
@ -1036,57 +1036,24 @@ NTSTATUS NTAPI SpLsaModeInitialize(ULONG lsa_version, PULONG package_version,
|
||||||
*package_version = SECPKG_INTERFACE_VERSION;
|
*package_version = SECPKG_INTERFACE_VERSION;
|
||||||
*table = &kerberos_table;
|
*table = &kerberos_table;
|
||||||
*table_count = 1;
|
*table_count = 1;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI kerberos_SpInstanceInit(ULONG version, SECPKG_DLL_FUNCTIONS *dll_function_table, void **user_functions)
|
static NTSTATUS NTAPI kerberos_SpInstanceInit(ULONG version, SECPKG_DLL_FUNCTIONS *dll_function_table, void **user_functions)
|
||||||
{
|
{
|
||||||
TRACE("%#x,%p,%p\n", version, dll_function_table, user_functions);
|
TRACE("%#x,%p,%p\n", version, dll_function_table, user_functions);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS SEC_ENTRY kerberos_SpMakeSignature( LSA_SEC_HANDLE context, ULONG quality_of_protection,
|
static NTSTATUS SEC_ENTRY kerberos_SpMakeSignature( LSA_SEC_HANDLE context, ULONG quality_of_protection,
|
||||||
SecBufferDesc *message, ULONG message_seq_no )
|
SecBufferDesc *message, ULONG message_seq_no )
|
||||||
{
|
{
|
||||||
#ifdef SONAME_LIBGSSAPI_KRB5
|
|
||||||
OM_uint32 ret, minor_status;
|
|
||||||
gss_buffer_desc data_buffer, token_buffer;
|
|
||||||
gss_ctx_id_t ctxt_handle;
|
|
||||||
int data_idx, token_idx;
|
|
||||||
|
|
||||||
TRACE( "(%lx 0x%08x %p %u)\n", context, quality_of_protection, message, message_seq_no );
|
TRACE( "(%lx 0x%08x %p %u)\n", context, quality_of_protection, message, message_seq_no );
|
||||||
if (quality_of_protection) FIXME( "ignoring quality_of_protection 0x%08x\n", quality_of_protection );
|
if (quality_of_protection) FIXME( "ignoring quality_of_protection 0x%08x\n", quality_of_protection );
|
||||||
if (message_seq_no) FIXME( "ignoring message_seq_no %u\n", message_seq_no );
|
if (message_seq_no) FIXME( "ignoring message_seq_no %u\n", message_seq_no );
|
||||||
|
|
||||||
if (!context) return SEC_E_INVALID_HANDLE;
|
if (!context) return SEC_E_INVALID_HANDLE;
|
||||||
ctxt_handle = ctxthandle_sspi_to_gss( context );
|
return krb5_funcs->make_signature( context, message );
|
||||||
|
|
||||||
/* FIXME: multiple data buffers, read-only buffers */
|
|
||||||
if ((data_idx = get_buffer_index( message, SECBUFFER_DATA )) == -1) return SEC_E_INVALID_TOKEN;
|
|
||||||
data_buffer.length = message->pBuffers[data_idx].cbBuffer;
|
|
||||||
data_buffer.value = message->pBuffers[data_idx].pvBuffer;
|
|
||||||
|
|
||||||
if ((token_idx = get_buffer_index( message, SECBUFFER_TOKEN )) == -1) return SEC_E_INVALID_TOKEN;
|
|
||||||
token_buffer.length = 0;
|
|
||||||
token_buffer.value = NULL;
|
|
||||||
|
|
||||||
ret = pgss_get_mic( &minor_status, ctxt_handle, GSS_C_QOP_DEFAULT, &data_buffer, &token_buffer );
|
|
||||||
TRACE( "gss_get_mic returned %08x minor status %08x\n", ret, minor_status );
|
|
||||||
if (GSS_ERROR(ret)) trace_gss_status( ret, minor_status );
|
|
||||||
if (ret == GSS_S_COMPLETE)
|
|
||||||
{
|
|
||||||
memcpy( message->pBuffers[token_idx].pvBuffer, token_buffer.value, token_buffer.length );
|
|
||||||
message->pBuffers[token_idx].cbBuffer = token_buffer.length;
|
|
||||||
pgss_release_buffer( &minor_status, &token_buffer );
|
|
||||||
}
|
|
||||||
|
|
||||||
return status_gss_to_sspi( ret );
|
|
||||||
#else
|
|
||||||
FIXME( "(%lx 0x%08x %p %u)\n", context, quality_of_protection, message, message_seq_no );
|
|
||||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI kerberos_SpVerifySignature( LSA_SEC_HANDLE context, SecBufferDesc *message,
|
static NTSTATUS NTAPI kerberos_SpVerifySignature( LSA_SEC_HANDLE context, SecBufferDesc *message,
|
||||||
|
|
|
@ -558,6 +558,35 @@ static NTSTATUS CDECL initialize_context( LSA_SEC_HANDLE credential, LSA_SEC_HAN
|
||||||
return status_gss_to_sspi( ret );
|
return status_gss_to_sspi( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS CDECL make_signature( LSA_SEC_HANDLE context, SecBufferDesc *msg )
|
||||||
|
{
|
||||||
|
OM_uint32 ret, minor_status;
|
||||||
|
gss_buffer_desc data_buffer, token_buffer;
|
||||||
|
gss_ctx_id_t ctx_handle = ctxhandle_sspi_to_gss( 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;
|
||||||
|
token_buffer.length = 0;
|
||||||
|
token_buffer.value = NULL;
|
||||||
|
|
||||||
|
ret = pgss_get_mic( &minor_status, ctx_handle, GSS_C_QOP_DEFAULT, &data_buffer, &token_buffer );
|
||||||
|
TRACE( "gss_get_mic returned %08x minor status %08x\n", ret, minor_status );
|
||||||
|
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;
|
||||||
|
pgss_release_buffer( &minor_status, &token_buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
return status_gss_to_sspi( ret );
|
||||||
|
}
|
||||||
|
|
||||||
static const struct krb5_funcs funcs =
|
static const struct krb5_funcs funcs =
|
||||||
{
|
{
|
||||||
accept_context,
|
accept_context,
|
||||||
|
@ -565,6 +594,7 @@ static const struct krb5_funcs funcs =
|
||||||
delete_context,
|
delete_context,
|
||||||
free_credentials_handle,
|
free_credentials_handle,
|
||||||
initialize_context,
|
initialize_context,
|
||||||
|
make_signature,
|
||||||
};
|
};
|
||||||
|
|
||||||
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct krb5_funcs
|
||||||
NTSTATUS (CDECL *free_credentials_handle)(LSA_SEC_HANDLE);
|
NTSTATUS (CDECL *free_credentials_handle)(LSA_SEC_HANDLE);
|
||||||
NTSTATUS (CDECL *initialize_context)(LSA_SEC_HANDLE, LSA_SEC_HANDLE, const char *, ULONG, SecBufferDesc *,
|
NTSTATUS (CDECL *initialize_context)(LSA_SEC_HANDLE, LSA_SEC_HANDLE, const char *, ULONG, SecBufferDesc *,
|
||||||
LSA_SEC_HANDLE *, SecBufferDesc *, ULONG *, TimeStamp *);
|
LSA_SEC_HANDLE *, SecBufferDesc *, ULONG *, TimeStamp *);
|
||||||
|
NTSTATUS (CDECL *make_signature)(LSA_SEC_HANDLE, SecBufferDesc *);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct krb5_funcs *krb5_funcs;
|
extern const struct krb5_funcs *krb5_funcs;
|
||||||
|
|
Loading…
Reference in New Issue