spnego_sspi: honor CURLOPT_GSSAPI_DELEGATION for Windows SSPI

Make CURLOPT_GSSAPI_DELEGATION effective on Windows builds that use SSPI
(instead of a native GSS-API implementation), so Kerberos delegation can
be requested during SPNEGO/Negotiate authentication.

Closes #21528
This commit is contained in:
Song X. Gao 2026-05-11 12:45:15 -04:00 committed by Daniel Stenberg
parent 2256162fa7
commit cc6777d939
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 128 additions and 15 deletions

View file

@ -223,15 +223,21 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
resp_buf.cbBuffer = curlx_uztoul(nego->token_max);
/* Generate our challenge-response message */
nego->status =
Curl_pSecFn->InitializeSecurityContext(nego->credentials,
chlg ? nego->context : NULL,
nego->spn,
ISC_REQ_CONFIDENTIALITY,
0, SECURITY_NATIVE_DREP,
chlg ? &chlg_desc : NULL,
0, nego->context,
&resp_desc, &attrs, NULL);
{
DWORD sspi_flags = ISC_REQ_CONFIDENTIALITY;
if(data->set.gssapi_delegation & (CURLGSSAPI_DELEGATION_FLAG |
CURLGSSAPI_DELEGATION_POLICY_FLAG))
sspi_flags |= ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH;
nego->status =
Curl_pSecFn->InitializeSecurityContext(nego->credentials,
chlg ? nego->context : NULL,
nego->spn,
sspi_flags,
0, SECURITY_NATIVE_DREP,
chlg ? &chlg_desc : NULL,
0, nego->context,
&resp_desc, &attrs, NULL);
}
/* Free the decoded challenge as it is not required anymore */
curlx_free(chlg);