]> granicus.if.org Git - curl/commitdiff
http_negotiate: do not close connection until negotiation is completed
authorElia Tufarolo <elia.tufarolo@hcl.com>
Tue, 13 Nov 2018 17:30:56 +0000 (18:30 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 16 Nov 2018 22:38:47 +0000 (23:38 +0100)
Fix HTTP POST using CURLAUTH_NEGOTIATE.

Closes #3275

lib/http.c
lib/http_negotiate.c

index 46ac15a6e2e09dbc422888d78b6c6123dda1dda5..afc919b0960114d5890a863ea81388e6eced947f 100644 (file)
@@ -610,7 +610,6 @@ output_auth_headers(struct connectdata *conn,
     result = Curl_output_negotiate(conn, proxy);
     if(result)
       return result;
-    authstatus->done = TRUE;
     negdata->state = GSS_AUTHSENT;
   }
   else
index ddcd65b3b9cb6881c2af1764b688b5b27cb7d827..444265d11f3eb53f49dbdc254235847b449b7823 100644 (file)
@@ -49,6 +49,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
 
   /* Point to the correct struct with this */
   struct negotiatedata *neg_ctx;
+  struct auth *authp;
 
   if(proxy) {
     userp = conn->http_proxy.user;
@@ -57,6 +58,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
               data->set.str[STRING_PROXY_SERVICE_NAME] : "HTTP";
     host = conn->http_proxy.host.name;
     neg_ctx = &data->state.proxyneg;
+    authp = &conn->data->state.authproxy;
   }
   else {
     userp = conn->user;
@@ -65,6 +67,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
               data->set.str[STRING_SERVICE_NAME] : "HTTP";
     host = conn->host.name;
     neg_ctx = &data->state.negotiate;
+    authp = &conn->data->state.authhost;
   }
 
   /* Not set means empty */
@@ -95,6 +98,11 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
 
   if(result)
     Curl_auth_spnego_cleanup(neg_ctx);
+  else
+    /* If the status is different than 0 and we encountered no errors
+    it means we have to continue. 0 is the OK value for both GSSAPI
+    (GSS_S_COMPLETE) and SSPI (SEC_E_OK) */
+    authp->done = !neg_ctx->status;
 
   return result;
 }