summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-03-03 10:48:24 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2016-03-03 11:18:03 +0100
commita4cba9d45384eec145537438a8e2d765c3a0bf11 (patch)
treed8a897aa6662d88b9c8ed4e9d82d59e214c20889 /src
parent25205737781ec0d73e57283f43e5d4fdf355a0dc (diff)
downloadlibgit2-a4cba9d45384eec145537438a8e2d765c3a0bf11.tar.gz
winhttp: retry authentication
If the caller has provided bad authentication, give them another apportunity to get it right until they give up. This brings WinHTTP in line with the other transports.
Diffstat (limited to 'src')
-rw-r--r--src/transports/winhttp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index ded041686..32b838084 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -926,10 +926,11 @@ replay:
if (parse_unauthorized_response(s->request, &allowed_types, &t->auth_mechanism) < 0)
return -1;
- if (allowed_types &&
- (!t->cred || 0 == (t->cred->credtype & allowed_types))) {
+ if (allowed_types) {
int cred_error = 1;
+ git_cred_free(t->cred);
+ t->cred = NULL;
/* Start with the user-supplied credential callback, if present */
if (t->owner->cred_acquire_cb) {
cred_error = t->owner->cred_acquire_cb(&t->cred, t->owner->url,