mirror of
https://github.com/curl/curl.git
synced 2026-08-26 09:23:31 +03:00
digest: flush state on origin or credential change
Verified by test 1686 Closes #21944
This commit is contained in:
parent
3f1055303e
commit
5c6b488035
8 changed files with 203 additions and 4 deletions
|
|
@ -94,6 +94,22 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
|
|||
#endif
|
||||
}
|
||||
else {
|
||||
bool flush = FALSE;
|
||||
DEBUGASSERT(data->conn->origin);
|
||||
if(data->state.digest.origin &&
|
||||
!Curl_peer_same_destination(data->conn->origin,
|
||||
data->state.digest.origin))
|
||||
flush = TRUE;
|
||||
else if(data->state.digest.creds &&
|
||||
!Curl_creds_same(data->state.creds, data->state.digest.creds))
|
||||
flush = TRUE;
|
||||
|
||||
if(flush)
|
||||
/* flush host Digest state */
|
||||
Curl_auth_digest_cleanup(&data->state.digest);
|
||||
|
||||
Curl_peer_link(&data->state.digest.origin, data->conn->origin);
|
||||
Curl_creds_link(&data->state.digest.creds, data->state.creds);
|
||||
digest = &data->state.digest;
|
||||
allocuserpwd = &data->req.hd_auth;
|
||||
creds = data->state.creds;
|
||||
|
|
|
|||
|
|
@ -148,13 +148,12 @@ typedef CURLcode (Curl_recv)(struct Curl_easy *data, /* transfer */
|
|||
#ifndef CURL_DISABLE_DIGEST_AUTH
|
||||
/* Struct used for Digest challenge-response authentication */
|
||||
struct digestdata {
|
||||
struct Curl_creds *creds;
|
||||
struct Curl_peer *origin;
|
||||
#ifdef USE_WINDOWS_SSPI
|
||||
BYTE *input_token;
|
||||
size_t input_token_len;
|
||||
CtxtHandle *http_context;
|
||||
/* linked credentials used to make the identity for http_context.
|
||||
may be NULL. */
|
||||
struct Curl_creds *creds;
|
||||
#else
|
||||
char *nonce;
|
||||
char *cnonce;
|
||||
|
|
|
|||
|
|
@ -1039,6 +1039,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
|||
*/
|
||||
void Curl_auth_digest_cleanup(struct digestdata *digest)
|
||||
{
|
||||
Curl_peer_unlink(&digest->origin);
|
||||
Curl_creds_unlink(&digest->creds);
|
||||
curlx_safefree(digest->nonce);
|
||||
curlx_safefree(digest->cnonce);
|
||||
curlx_safefree(digest->realm);
|
||||
|
|
|
|||
|
|
@ -630,6 +630,7 @@ void Curl_auth_digest_cleanup(struct digestdata *digest)
|
|||
|
||||
/* Free the copy of user/passwd used to make the identity for http_context */
|
||||
Curl_creds_unlink(&digest->creds);
|
||||
Curl_peer_unlink(&digest->origin);
|
||||
}
|
||||
|
||||
#endif /* USE_WINDOWS_SSPI && !CURL_DISABLE_DIGEST_AUTH */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue