summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-14 11:15:51 -0400
committerGitHub <noreply@github.com>2021-08-14 11:15:51 -0400
commitc1c598433e9e2aab833532227dbaa025f51c9fb4 (patch)
tree9cde9e9df0a73f59727da16427281cdf9b8603de
parent631ae5a67f17fd12c4c2b2406bec96fe61c473ff (diff)
parent28841241745bdc30be0ef78235f3c4ba38345590 (diff)
downloadlibgit2-c1c598433e9e2aab833532227dbaa025f51c9fb4.tar.gz
Merge pull request #5972 from libgit2/ethomson/http_empty_password
http: don't require a password
-rw-r--r--src/transports/http.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/transports/http.c b/src/transports/http.c
index 4538dd143..9871be5ad 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -104,6 +104,11 @@ static int apply_url_credentials(
const char *username,
const char *password)
{
+ GIT_ASSERT_ARG(username);
+
+ if (!password)
+ password = "";
+
if (allowed_types & GIT_CREDENTIAL_USERPASS_PLAINTEXT)
return git_credential_userpass_plaintext_new(cred, username, password);
@@ -138,8 +143,7 @@ static int handle_auth(
/* Start with URL-specified credentials, if there were any. */
if ((allowed_credtypes & GIT_CREDENTIAL_USERPASS_PLAINTEXT) &&
!server->url_cred_presented &&
- server->url.username &&
- server->url.password) {
+ server->url.username) {
error = apply_url_credentials(&server->cred, allowed_credtypes, server->url.username, server->url.password);
server->url_cred_presented = 1;