ldap: Use SECPKG_ATTR_SESSION_KEY to retrieve the key size.

This commit is contained in:
Hans Leidekker 2023-08-02 16:56:51 +02:00 committed by Alexandre Julliard
parent 26c19ea681
commit 51571ba577

View file

@ -220,6 +220,14 @@ static int fill_auth_identity( const sasl_interact_t *prompts, SEC_WINNT_AUTH_ID
return SASL_OK;
}
static ULONG get_key_size( CtxtHandle *ctx )
{
SecPkgContext_SessionKey key;
if (QueryContextAttributesA( ctx, SECPKG_ATTR_SESSION_KEY, &key )) return 0;
FreeContextBuffer( key.SessionKey );
return key.SessionKeyLength * 8;
}
int sasl_client_start( sasl_conn_t *handle, const char *mechlist, sasl_interact_t **prompts,
const char **clientout, unsigned int *clientoutlen, const char **mech )
{
@ -287,14 +295,9 @@ int sasl_client_step( sasl_conn_t *handle, const char *serverin, unsigned int se
if (status == SEC_I_CONTINUE_NEEDED) return SASL_CONTINUE;
else
{
SecPkgContext_KeyInfoA key;
SecPkgContext_Sizes sizes;
status = QueryContextAttributesA( &conn->ctxt_handle, SECPKG_ATTR_KEY_INFO, &key );
if (status != SEC_E_OK) return SASL_FAIL;
FreeContextBuffer( key.sSignatureAlgorithmName );
FreeContextBuffer( key.sEncryptAlgorithmName );
conn->ssf = key.KeySize;
conn->ssf = get_key_size( &conn->ctxt_handle );
status = QueryContextAttributesA( &conn->ctxt_handle, SECPKG_ATTR_SIZES, &sizes );
if (status != SEC_E_OK) return SASL_FAIL;