http_digest: Moved clean-up function into SASL module
This commit is contained in:
Родитель
d7bfce3951
Коммит
25264131e2
|
@ -582,6 +582,29 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
|||
}
|
||||
#endif /* !USE_WINDOWS_SSPI */
|
||||
|
||||
/*
|
||||
* Curl_sasl_digest_cleanup()
|
||||
*
|
||||
* This is used to clean up the digest specific data.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* digest [in/out] - The digest data struct being cleaned up.
|
||||
*
|
||||
*/
|
||||
void Curl_sasl_digest_cleanup(struct digestdata *digest)
|
||||
{
|
||||
Curl_safefree(digest->nonce);
|
||||
Curl_safefree(digest->cnonce);
|
||||
Curl_safefree(digest->realm);
|
||||
Curl_safefree(digest->opaque);
|
||||
Curl_safefree(digest->qop);
|
||||
Curl_safefree(digest->algorithm);
|
||||
|
||||
digest->nc = 0;
|
||||
digest->algo = CURLDIGESTALGO_MD5; /* default algorithm */
|
||||
digest->stale = FALSE; /* default means normal, not stale */
|
||||
}
|
||||
#endif /* CURL_DISABLE_CRYPTO_AUTH */
|
||||
|
||||
#ifdef USE_NTLM
|
||||
|
|
|
@ -104,6 +104,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
|||
const char *passwdp,
|
||||
const char *service,
|
||||
char **outptr, size_t *outlen);
|
||||
|
||||
/* This is used to clean up the digest specific data */
|
||||
void Curl_sasl_digest_cleanup(struct digestdata *digest);
|
||||
#endif
|
||||
|
||||
#ifdef USE_NTLM
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#define MAX_VALUE_LENGTH 256
|
||||
#define MAX_CONTENT_LENGTH 1024
|
||||
|
||||
static void digest_cleanup_one(struct digestdata *dig);
|
||||
|
||||
/*
|
||||
* Return 0 on success and then the buffers are filled in fine.
|
||||
*
|
||||
|
@ -150,7 +148,7 @@ CURLcode Curl_input_digest(struct connectdata *conn,
|
|||
before = TRUE;
|
||||
|
||||
/* clear off any former leftovers and init to defaults */
|
||||
digest_cleanup_one(d);
|
||||
Curl_sasl_digest_cleanup(d);
|
||||
|
||||
for(;;) {
|
||||
char value[MAX_VALUE_LENGTH];
|
||||
|
@ -579,25 +577,10 @@ CURLcode Curl_output_digest(struct connectdata *conn,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static void digest_cleanup_one(struct digestdata *d)
|
||||
{
|
||||
Curl_safefree(d->nonce);
|
||||
Curl_safefree(d->cnonce);
|
||||
Curl_safefree(d->realm);
|
||||
Curl_safefree(d->opaque);
|
||||
Curl_safefree(d->qop);
|
||||
Curl_safefree(d->algorithm);
|
||||
|
||||
d->nc = 0;
|
||||
d->algo = CURLDIGESTALGO_MD5; /* default algorithm */
|
||||
d->stale = FALSE; /* default means normal, not stale */
|
||||
}
|
||||
|
||||
|
||||
void Curl_digest_cleanup(struct SessionHandle *data)
|
||||
{
|
||||
digest_cleanup_one(&data->state.digest);
|
||||
digest_cleanup_one(&data->state.proxydigest);
|
||||
Curl_sasl_digest_cleanup(&data->state.digest);
|
||||
Curl_sasl_digest_cleanup(&data->state.proxydigest);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче