diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_sasl.c | 23 | ||||
-rw-r--r-- | lib/curl_sasl.h | 3 | ||||
-rw-r--r-- | lib/http_digest.c | 23 |
3 files changed, 29 insertions, 20 deletions
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index 3bf973d95..ebb8d8153 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -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 diff --git a/lib/curl_sasl.h b/lib/curl_sasl.h index 3576d4199..8fcce320f 100644 --- a/lib/curl_sasl.h +++ b/lib/curl_sasl.h @@ -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 diff --git a/lib/http_digest.c b/lib/http_digest.c index 1d42769c5..d2dbfe59b 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -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 |