1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

msv1_0: Implement SECPKG_ATTR_SESSION_KEY.

This commit is contained in:
Hans Leidekker 2023-08-01 15:01:53 +02:00 committed by Alexandre Julliard
parent 922372e64c
commit da750b77bd
2 changed files with 23 additions and 1 deletions

View File

@ -1138,7 +1138,6 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON
X(SECPKG_ATTR_NATIVE_NAMES);
X(SECPKG_ATTR_PACKAGE_INFO);
X(SECPKG_ATTR_PASSWORD_EXPIRY);
X(SECPKG_ATTR_SESSION_KEY);
X(SECPKG_ATTR_STREAM_SIZES);
X(SECPKG_ATTR_TARGET_INFORMATION);
case SECPKG_ATTR_FLAGS:
@ -1167,6 +1166,19 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON
info->NegotiationState = SECPKG_NEGOTIATION_COMPLETE;
return SEC_E_OK;
}
case SECPKG_ATTR_SESSION_KEY:
{
struct ntlm_ctx *ctx = (struct ntlm_ctx *)handle;
SecPkgContext_SessionKey *key = (SecPkgContext_SessionKey *)buf;
unsigned char *session_key;
if (!(session_key = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(ctx->session_key) )))
return SEC_E_INSUFFICIENT_MEMORY;
memcpy( session_key, ctx->session_key, sizeof(ctx->session_key) );
key->SessionKey = session_key;
key->SessionKeyLength = sizeof(ctx->session_key);
return SEC_E_OK;
}
case SECPKG_ATTR_KEY_INFO:
{
struct ntlm_ctx *ctx = (struct ntlm_ctx *)handle;

View File

@ -824,6 +824,7 @@ static void testAuth(ULONG data_rep, BOOL fake)
SecPkgContext_StreamSizes stream_sizes;
SecPkgContext_NegotiationInfoA info;
SecPkgContext_KeyInfoA key;
SecPkgContext_SessionKey session_key;
SecPkgInfoA *pi;
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
@ -927,6 +928,15 @@ static void testAuth(ULONG data_rep, BOOL fake)
}
ok( key.KeySize == 128, "got %lu\n", key.KeySize );
ok( key.EncryptAlgorithm == CALG_RC4, "got %#lx\n", key.EncryptAlgorithm );
FreeContextBuffer( key.sSignatureAlgorithmName );
FreeContextBuffer( key.sEncryptAlgorithmName );
memset( &session_key, 0, sizeof(session_key) );
sec_status = QueryContextAttributesA( &client.ctxt, SECPKG_ATTR_SESSION_KEY, &session_key );
ok( sec_status == SEC_E_OK, "pQueryContextAttributesA returned %08lx\n", sec_status );
ok( session_key.SessionKeyLength, "got 0 key length\n" );
ok( session_key.SessionKey != NULL, "got NULL session key\n" );
FreeContextBuffer( session_key.SessionKey );
memset(&info, 0, sizeof(info));
sec_status = QueryContextAttributesA(&client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info);