mirror of
https://github.com/curl/curl.git
synced 2026-07-24 13:17:15 +03:00
cli_hx_download: add Schannel support
Fixes: ``` $ wine libtests.exe cli_hx_download https://curl.se/ [...] Assertion failed: t->checked_ssl, file .../curl/tests/libtest/cli_hx_download.c, line 563 ``` into: ``` [t-0] info Schannel TLS version 0x00000800 ``` Refs: https://learn.microsoft.com/windows/win32/secauthn/querycontextattributes--general https://learn.microsoft.com/windows/win32/api/schannel/ns-schannel-secpkgcontext_connectioninfo Ref:c220674ac4#20564 Follow-up toba9ddb9357#18066 Closes #20556
This commit is contained in:
parent
325d0e0a68
commit
85a895c59f
1 changed files with 22 additions and 1 deletions
|
|
@ -42,6 +42,11 @@
|
|||
#ifdef USE_RUSTLS
|
||||
#include <rustls.h>
|
||||
#endif
|
||||
#ifdef USE_SCHANNEL
|
||||
#include <sspi.h> /* for CtxtHandle, QueryContextAttributes() */
|
||||
#include <schannel.h> /* for SecPkgContext_ConnectionInfo,
|
||||
SECPKG_ATTR_CONNECTION_INFO */
|
||||
#endif
|
||||
|
||||
static int verbose_d = 1;
|
||||
|
||||
|
|
@ -133,7 +138,8 @@ static int my_progress_d_cb(void *userdata,
|
|||
}
|
||||
|
||||
#if defined(USE_QUICHE) || defined(USE_OPENSSL) || defined(USE_WOLFSSL) || \
|
||||
defined(USE_GNUTLS) || defined(USE_MBEDTLS) || defined(USE_RUSTLS)
|
||||
defined(USE_GNUTLS) || defined(USE_MBEDTLS) || defined(USE_RUSTLS) || \
|
||||
defined(USE_SCHANNEL)
|
||||
if(!t->checked_ssl && dlnow > 0) {
|
||||
struct curl_tlssessioninfo *tls;
|
||||
CURLcode result;
|
||||
|
|
@ -196,6 +202,21 @@ static int my_progress_d_cb(void *userdata,
|
|||
t->idx, v);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SCHANNEL
|
||||
case CURLSSLBACKEND_SCHANNEL: {
|
||||
CtxtHandle *ctxt_handle = (CtxtHandle *)tls->internals;
|
||||
SecPkgContext_ConnectionInfo info;
|
||||
SECURITY_STATUS sspi_status;
|
||||
sspi_status = QueryContextAttributes(ctxt_handle,
|
||||
SECPKG_ATTR_CONNECTION_INFO,
|
||||
&info);
|
||||
assert(sspi_status == SEC_E_OK);
|
||||
(void)sspi_status;
|
||||
curl_mfprintf(stderr, "[t-%zu] info Schannel TLS version 0x%08lx\n",
|
||||
t->idx, info.dwProtocol);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
curl_mfprintf(stderr, "[t-%zu] info SSL_PTR backend=%d, ptr=%p\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue