]> granicus.if.org Git - curl/commitdiff
http_digest: Moved clean-up function into SASL module
authorSteve Holme <steve_holme@hotmail.com>
Wed, 5 Nov 2014 13:58:24 +0000 (13:58 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Wed, 5 Nov 2014 13:51:11 +0000 (13:51 +0000)
lib/curl_sasl.c
lib/curl_sasl.h
lib/http_digest.c

index 3bf973d95c7e9c03549eea9e072ffaaa39b77b66..ebb8d815304afeb5925fd79b000c8d5486743f3e 100644 (file)
@@ -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
index 3576d41990cf350924a67d0f1d9b0102954654e4..8fcce320f981799ec8e5d74d7cd7efb42c89b102 100644 (file)
@@ -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
index 1d42769c534e170ef4312281d1d93fc817781a7e..d2dbfe59bd1c150ea2a1c456e5b268cd14350f3f 100644 (file)
@@ -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