Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Borum <anders@algoritmer.dk>2018-10-06 13:58:06 +0300
committerPatrick Steinhardt <ps@pks.im>2018-10-26 15:58:52 +0300
commita77b64a5ebea1bb2edeaa1a3cb55b4b0933fb4e9 (patch)
treedcca8c9eff6afd3ea1afe1042febd49458f1c240
parent4ca4c7d1968281954e214d1cd80990c0e3543d70 (diff)
ignore unsupported http authentication schemes
auth_context_match returns 0 instead of -1 for unknown schemes to not fail in situations where some authentication schemes are supported and others are not. apply_credentials is adjusted to handle auth_context_match returning 0 without producing authentication context. (cherry picked from commit 475db39bb4c44a2221f340c66c227f555e478d10)
-rw-r--r--src/transports/http.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/transports/http.c b/src/transports/http.c
index 575d7c9d7..22b8bb864 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -142,7 +142,7 @@ static int auth_context_match(
}
if (!scheme)
- return -1;
+ return 0;
/* See if authentication has already started for this scheme */
git_vector_foreach(&t->auth_contexts, i, c) {
@@ -188,6 +188,9 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
if (auth_context_match(&context, t, credtype_match, &cred->credtype) < 0)
return -1;
+ if (!context)
+ return 0;
+
return context->next_token(buf, context, cred);
}