cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 3/5] Don't clear GSSAPI state between each exchange in the negotiation

From: David Woodhouse <dwmw2_at_infradead.org>
Date: Fri, 11 Jul 2014 12:29:04 +0100

From: David Woodhouse <David.Woodhouse_at_intel.com>

GSSAPI doesn't work very well if we forget everything ever time.

XX: Is Curl_http_done() the right place to do the final cleanup?

---
 lib/http.c                | 4 ++++
 lib/http_negotiate.c      | 1 -
 lib/http_negotiate_sspi.c | 1 -
 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/http.c b/lib/http.c
index 78791ee..249da0f 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1443,6 +1443,10 @@ CURLcode Curl_http_done(struct connectdata *conn,
 
   Curl_unencode_cleanup(conn);
 
+  if (data->state.proxyneg.state == GSS_AUTHSENT ||
+      data->state.negotiate.state == GSS_AUTHSENT)
+    Curl_cleanup_negotiate(data);
+
   /* set the proper values (possibly modified on POST) */
   conn->fread_func = data->set.fread_func; /* restore */
   conn->fread_in = data->set.in; /* restore */
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 9b01e0a..bbad0b4 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -250,7 +250,6 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
   }
 
   Curl_safefree(encoded);
-  Curl_cleanup_negotiate(conn->data);
 
   return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
 }
diff --git a/lib/http_negotiate_sspi.c b/lib/http_negotiate_sspi.c
index 8396a61..236766b 100644
--- a/lib/http_negotiate_sspi.c
+++ b/lib/http_negotiate_sspi.c
@@ -268,7 +268,6 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
   else
     conn->allocptr.userpwd = userp;
   free(encoded);
-  Curl_cleanup_negotiate (conn->data);
   return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
 }
 
-- 
1.9.3
-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse_at_intel.com                              Intel Corporation

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

  • application/x-pkcs7-signature attachment: smime.p7s
Received on 2014-07-11