Module: wine Branch: master Commit: 51571ba577a6cc210abf79f7c9bd2f1cebae5fa7 URL: https://gitlab.winehq.org/wine/wine/-/commit/51571ba577a6cc210abf79f7c9bd2f1...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Aug 2 16:56:51 2023 +0200
ldap: Use SECPKG_ATTR_SESSION_KEY to retrieve the key size.
---
libs/ldap/libldap/sasl_w.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libs/ldap/libldap/sasl_w.c b/libs/ldap/libldap/sasl_w.c index f257e4db9e3..0e45558461a 100644 --- a/libs/ldap/libldap/sasl_w.c +++ b/libs/ldap/libldap/sasl_w.c @@ -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;