Commit da750b77 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msv1_0: Implement SECPKG_ATTR_SESSION_KEY.

parent 922372e6
...@@ -1138,7 +1138,6 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON ...@@ -1138,7 +1138,6 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON
X(SECPKG_ATTR_NATIVE_NAMES); X(SECPKG_ATTR_NATIVE_NAMES);
X(SECPKG_ATTR_PACKAGE_INFO); X(SECPKG_ATTR_PACKAGE_INFO);
X(SECPKG_ATTR_PASSWORD_EXPIRY); X(SECPKG_ATTR_PASSWORD_EXPIRY);
X(SECPKG_ATTR_SESSION_KEY);
X(SECPKG_ATTR_STREAM_SIZES); X(SECPKG_ATTR_STREAM_SIZES);
X(SECPKG_ATTR_TARGET_INFORMATION); X(SECPKG_ATTR_TARGET_INFORMATION);
case SECPKG_ATTR_FLAGS: case SECPKG_ATTR_FLAGS:
...@@ -1167,6 +1166,19 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON ...@@ -1167,6 +1166,19 @@ static NTSTATUS NTAPI ntlm_SpQueryContextAttributes( LSA_SEC_HANDLE handle, ULON
info->NegotiationState = SECPKG_NEGOTIATION_COMPLETE; info->NegotiationState = SECPKG_NEGOTIATION_COMPLETE;
return SEC_E_OK; 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: case SECPKG_ATTR_KEY_INFO:
{ {
struct ntlm_ctx *ctx = (struct ntlm_ctx *)handle; struct ntlm_ctx *ctx = (struct ntlm_ctx *)handle;
......
...@@ -824,6 +824,7 @@ static void testAuth(ULONG data_rep, BOOL fake) ...@@ -824,6 +824,7 @@ static void testAuth(ULONG data_rep, BOOL fake)
SecPkgContext_StreamSizes stream_sizes; SecPkgContext_StreamSizes stream_sizes;
SecPkgContext_NegotiationInfoA info; SecPkgContext_NegotiationInfoA info;
SecPkgContext_KeyInfoA key; SecPkgContext_KeyInfoA key;
SecPkgContext_SessionKey session_key;
SecPkgInfoA *pi; SecPkgInfoA *pi;
if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK) if(pQuerySecurityPackageInfoA( sec_pkg_name, &pkg_info)!= SEC_E_OK)
...@@ -927,6 +928,15 @@ static void testAuth(ULONG data_rep, BOOL fake) ...@@ -927,6 +928,15 @@ static void testAuth(ULONG data_rep, BOOL fake)
} }
ok( key.KeySize == 128, "got %lu\n", key.KeySize ); ok( key.KeySize == 128, "got %lu\n", key.KeySize );
ok( key.EncryptAlgorithm == CALG_RC4, "got %#lx\n", key.EncryptAlgorithm ); 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)); memset(&info, 0, sizeof(info));
sec_status = QueryContextAttributesA(&client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info); sec_status = QueryContextAttributesA(&client.ctxt, SECPKG_ATTR_NEGOTIATION_INFO, &info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment