Commit 1c847169 by Edward Thomson

http: allow dummy negotiation scheme to fail to act

The dummy negotiation scheme is used for known authentication strategies
that do not wish to act.  For example, when a server requests the
"Negotiate" scheme but libgit2 is not built with Negotiate support, and
will use the "dummy" strategy which will simply not act.

Instead of setting `out` to NULL and returning a successful code, return
`GIT_PASSTHROUGH` to indicate that it did not act and catch that error
code.
parent 0f40e68e
......@@ -70,6 +70,6 @@ int git_http_auth_dummy(
GIT_UNUSED(url);
*out = NULL;
return 0;
return GIT_PASSTHROUGH;
}
......@@ -430,6 +430,7 @@ static int init_auth(http_server *server)
git_http_auth_scheme *s, *scheme = NULL;
char *c, *challenge = NULL;
size_t i;
int error;
git_vector_foreach(&server->auth_challenges, i, c) {
s = scheme_for_challenge(c);
......@@ -446,12 +447,14 @@ static int init_auth(http_server *server)
return -1;
}
if (scheme->init_context(&server->auth_context, &server->url) < 0)
return -1;
if ((error = scheme->init_context(&server->auth_context, &server->url)) == GIT_PASSTHROUGH)
return 0;
else if (error < 0)
return error;
if (server->auth_context->set_challenge &&
server->auth_context->set_challenge(server->auth_context, challenge) < 0)
return -1;
(error = server->auth_context->set_challenge(server->auth_context, challenge)) < 0)
return error;
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment