git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vilkov <dmitry.a.vilkov@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate
Date: Tue,  2 Feb 2016 12:11:24 +0300	[thread overview]
Message-ID: <1454404284-2197-1-git-send-email-dmitry.a.vilkov@gmail.com> (raw)

This is fix of bug introduced by 4dbe66464 commit.
The problem is that when username/password combination was not set,
the first HTTP(S) request will fail and user will be asked for
credentials. As a side effect of first HTTP(S) request, libcurl auth
method GSS-Negotiate will be disabled unconditionally. Although, we
haven't tried yet provided credentials for this auth method.

Signed-off-by: Dmitry Vilkov <dmitry.a.vilkov@gmail.com>
---
 http.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/http.c b/http.c
index 0da9e66..707ea84 100644
--- a/http.c
+++ b/http.c
@@ -951,12 +951,15 @@ static int handle_curl_result(struct slot_results *results)
 		return HTTP_MISSING_TARGET;
 	else if (results->http_code == 401) {
 		if (http_auth.username && http_auth.password) {
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+			if (http_auth_methods & CURLAUTH_GSSNEGOTIATE) {
+				http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
+				return HTTP_REAUTH;
+			}
+#endif
 			credential_reject(&http_auth);
 			return HTTP_NOAUTH;
 		} else {
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
-			http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
-#endif
 			return HTTP_REAUTH;
 		}
 	} else {
-- 
2.4.10

             reply	other threads:[~2016-02-02  9:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  9:11 Dmitry Vilkov [this message]
2016-02-02 20:37 ` [PATCH] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate Junio C Hamano
2016-02-02 23:29   ` brian m. carlson
2016-02-05  9:18     ` Dmitry Vilkov
2016-02-05 17:54       ` Junio C Hamano
2016-02-05 20:58         ` brian m. carlson
2016-02-06 17:53         ` Daniel Stenberg
2016-02-05 20:46       ` brian m. carlson
2016-02-05 21:02         ` Junio C Hamano
2016-02-05 21:06           ` brian m. carlson
2016-02-05 21:52             ` Junio C Hamano
2016-02-08  9:11               ` Dmitry Vilkov
2016-02-15 18:44                 ` [PATCH] http: add option to try authentication without username brian m. carlson
2016-02-15 20:19                   ` Eric Sunshine
2016-02-15 20:29                     ` brian m. carlson
2016-02-15 20:34                       ` Jeff King
2016-02-15 20:36                         ` brian m. carlson
2016-02-15 21:39                           ` Junio C Hamano
2016-02-15 21:41                             ` brian m. carlson
2016-02-15 21:46                             ` Eric Sunshine
2016-02-15 21:51                               ` brian m. carlson
2016-02-20 14:35                 ` [PATCH] remote-curl: don't fall back to Basic auth if we haven't tried Negotiate Dmitry Vilkov
2016-02-20 15:23                   ` brian m. carlson
2016-02-20 21:38                   ` Junio C Hamano
2016-02-25 16:54                     ` Dmitry Vilkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454404284-2197-1-git-send-email-dmitry.a.vilkov@gmail.com \
    --to=dmitry.a.vilkov@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).