Blame SOURCES/0056-curl-7.29.0-0afbcfd8.patch

4604e0
From bf614e0e8a231b820160ebca2bc13afeee44c683 Mon Sep 17 00:00:00 2001
4604e0
From: Isaac Boukris <iboukris@gmail.com>
4604e0
Date: Fri, 27 Jan 2017 00:42:28 +0200
4604e0
Subject: [PATCH 1/3] authneg: clear auth.multi flag at http_done
4604e0
4604e0
This flag is meant for the current request based on authentication
4604e0
state, once the request is done we can clear the flag.
4604e0
4604e0
Also change auth.multi to auth.multipass for better readability.
4604e0
4604e0
Fixes https://github.com/curl/curl/issues/1095
4604e0
Closes https://github.com/curl/curl/pull/1326
4604e0
4604e0
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
4604e0
Reported-by: Michael Kaufmann
4604e0
4604e0
Upstream-commit: 5278462c32a70cd972a8cc824a38f164151d6c6d
4604e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
4604e0
---
4604e0
 lib/http.c    | 11 ++++++++---
4604e0
 lib/urldata.h |  4 ++--
4604e0
 2 files changed, 10 insertions(+), 5 deletions(-)
4604e0
4604e0
diff --git a/lib/http.c b/lib/http.c
4604e0
index db37cf9..9419bff 100644
4604e0
--- a/lib/http.c
4604e0
+++ b/lib/http.c
4604e0
@@ -585,10 +585,10 @@ output_auth_headers(struct connectdata *conn,
4604e0
           proxy?"Proxy":"Server", auth,
4604e0
           proxy?(conn->proxyuser?conn->proxyuser:""):
4604e0
                 (conn->user?conn->user:""));
4604e0
-    authstatus->multi = (!authstatus->done) ? TRUE : FALSE;
4604e0
+    authstatus->multipass = (!authstatus->done) ? TRUE : FALSE;
4604e0
   }
4604e0
   else
4604e0
-    authstatus->multi = FALSE;
4604e0
+    authstatus->multipass = FALSE;
4604e0
 
4604e0
   return CURLE_OK;
4604e0
 }
4604e0
@@ -1402,6 +1402,11 @@ CURLcode Curl_http_done(struct connectdata *conn,
4604e0
   struct SessionHandle *data = conn->data;
4604e0
   struct HTTP *http =data->state.proto.http;
4604e0
 
4604e0
+  /* Clear multipass flag. If authentication isn't done yet, then it will get
4604e0
+   * a chance to be set back to true when we output the next auth header */
4604e0
+  data->state.authhost.multipass = FALSE;
4604e0
+  data->state.authproxy.multipass = FALSE;
4604e0
+
4604e0
   Curl_unencode_cleanup(conn);
4604e0
 
4604e0
 #ifdef USE_HTTP_NEGOTIATE
4604e0
@@ -1738,7 +1743,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
4604e0
   if(result)
4604e0
     return result;
4604e0
 
4604e0
-  if((data->state.authhost.multi || data->state.authproxy.multi) &&
4604e0
+  if((data->state.authhost.multipass || data->state.authproxy.multipass) &&
4604e0
      (httpreq != HTTPREQ_GET) &&
4604e0
      (httpreq != HTTPREQ_HEAD)) {
4604e0
     /* Auth is required and we are not authenticated yet. Make a PUT or POST
4604e0
diff --git a/lib/urldata.h b/lib/urldata.h
4604e0
index 3e6ace5..7e0c30d 100644
4604e0
--- a/lib/urldata.h
4604e0
+++ b/lib/urldata.h
4604e0
@@ -1143,8 +1143,8 @@ struct auth {
4604e0
                           this resource */
4604e0
   bool done;  /* TRUE when the auth phase is done and ready to do the *actual*
4604e0
                  request */
4604e0
-  bool multi; /* TRUE if this is not yet authenticated but within the auth
4604e0
-                 multipass negotiation */
4604e0
+  bool multipass; /* TRUE if this is not yet authenticated but within the
4604e0
+                     auth multipass negotiation */
4604e0
   bool iestyle; /* TRUE if digest should be done IE-style or FALSE if it should
4604e0
                    be RFC compliant */
4604e0
 };
4604e0
-- 
4604e0
2.13.6
4604e0
4604e0
4604e0
From 8fe4533bc8de3664f8b664fa5ab78739b5ea3d87 Mon Sep 17 00:00:00 2001
4604e0
From: Michael Kaufmann <mail@michael-kaufmann.ch>
4604e0
Date: Sat, 11 Mar 2017 18:22:30 +0100
4604e0
Subject: [PATCH 2/3] curl_easy_reset: Also reset the authentication state
4604e0
4604e0
Follow-up to 5278462
4604e0
See https://github.com/curl/curl/issues/1095
4604e0
4604e0
Upstream-commit: 0afbcfd800c45e766e225e4ce273b128ee6a8c25
4604e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
4604e0
---
4604e0
 lib/easy.c | 4 ++++
4604e0
 1 file changed, 4 insertions(+)
4604e0
4604e0
diff --git a/lib/easy.c b/lib/easy.c
4604e0
index 13801b2..0e9ba18 100644
4604e0
--- a/lib/easy.c
4604e0
+++ b/lib/easy.c
4604e0
@@ -670,6 +670,10 @@ void curl_easy_reset(CURL *curl)
4604e0
 
4604e0
   data->progress.flags |= PGRS_HIDE;
4604e0
   data->state.current_speed = -1; /* init to negative == impossible */
4604e0
+
4604e0
+  /* zero out authentication data: */
4604e0
+  memset(&data->state.authhost, 0, sizeof(struct auth));
4604e0
+  memset(&data->state.authproxy, 0, sizeof(struct auth));
4604e0
 }
4604e0
 
4604e0
 /*
4604e0
-- 
4604e0
2.13.6
4604e0
4604e0
4604e0
From db75a5b82f0b4b24a838fb91e9d3352d4c4c05f2 Mon Sep 17 00:00:00 2001
4604e0
From: Michael Kaufmann <mail@michael-kaufmann.ch>
4604e0
Date: Sat, 11 Mar 2017 20:06:56 +0100
4604e0
Subject: [PATCH 3/3] tests: fix the authretry tests
4604e0
4604e0
Do not call curl_easy_reset() between the requests, because the
4604e0
auth state must be preserved for these tests.
4604e0
4604e0
Follow-up to 0afbcfd
4604e0
4604e0
Upstream-commit: 8d105209933e27293cfc4f224614cea57ddd8372
4604e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
4604e0
---
4604e0
 tests/libtest/libauthretry.c | 5 -----
4604e0
 1 file changed, 5 deletions(-)
4604e0
4604e0
diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c
4604e0
index 9576132..6342252 100644
4604e0
--- a/tests/libtest/libauthretry.c
4604e0
+++ b/tests/libtest/libauthretry.c
4604e0
@@ -111,12 +111,10 @@ int test(char *url)
4604e0
   res = send_wrong_password(curl, url, 100, main_auth_scheme);
4604e0
   if (res != CURLE_OK)
4604e0
       goto test_cleanup;
4604e0
-  curl_easy_reset(curl);
4604e0
 
4604e0
   res = send_right_password(curl, url, 200, fallback_auth_scheme);
4604e0
   if (res != CURLE_OK)
4604e0
       goto test_cleanup;
4604e0
-  curl_easy_reset(curl);
4604e0
 
4604e0
   curl_easy_cleanup(curl);
4604e0
 
4604e0
@@ -131,17 +129,14 @@ int test(char *url)
4604e0
   res = send_wrong_password(curl, url, 300, main_auth_scheme);
4604e0
   if (res != CURLE_OK)
4604e0
       goto test_cleanup;
4604e0
-  curl_easy_reset(curl);
4604e0
 
4604e0
   res = send_wrong_password(curl, url, 400, fallback_auth_scheme);
4604e0
   if (res != CURLE_OK)
4604e0
       goto test_cleanup;
4604e0
-  curl_easy_reset(curl);
4604e0
 
4604e0
   res = send_right_password(curl, url, 500, fallback_auth_scheme);
4604e0
   if (res != CURLE_OK)
4604e0
       goto test_cleanup;
4604e0
-  curl_easy_reset(curl);
4604e0
 
4604e0
 test_cleanup:
4604e0
 
4604e0
-- 
4604e0
2.13.6
4604e0