summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-02-04 13:52:18 -0800
committerBen Straub <bs@github.com>2013-02-04 13:52:18 -0800
commit630146bd1b71cbb450f1fe658048ca8e25479105 (patch)
tree98bab53dee0d691866dab6e6b465577930fe3d04
parent15760c598d57233820a68d2721643c637207a18e (diff)
downloadlibgit2-630146bd1b71cbb450f1fe658048ca8e25479105.tar.gz
Address feedback
-rw-r--r--src/transports/cred_helpers.c12
-rw-r--r--src/transports/git.c8
2 files changed, 12 insertions, 8 deletions
diff --git a/src/transports/cred_helpers.c b/src/transports/cred_helpers.c
index a05d5e874..d420e3e3c 100644
--- a/src/transports/cred_helpers.c
+++ b/src/transports/cred_helpers.c
@@ -23,7 +23,9 @@ int git_cred_userpass(
if (!userpass || !userpass->password) return -1;
/* Username resolution: a username can be passed with the URL, the
- * credentials payload, or both. Here's what we do.
+ * credentials payload, or both. Here's what we do. Note that if we get
+ * this far, we know that any password the url may contain has already
+ * failed at least once, so we ignore it.
*
* | Payload | URL | Used |
* +-------------+----------+-----------+
@@ -32,10 +34,12 @@ int git_cred_userpass(
* | no | yes | url |
* | no | no | FAIL |
*/
- effective_username = userpass->username;
- if (!userpass->username && user_from_url)
+ if (userpass->username)
+ effective_username = userpass->username;
+ else if (user_from_url)
effective_username = user_from_url;
- if (!effective_username) return -1;
+ else
+ return -1;
if ((GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types) == 0 ||
git_cred_userpass_plaintext_new(cred, effective_username, userpass->password) < 0)
diff --git a/src/transports/git.c b/src/transports/git.c
index a36a0a71c..3a0b86345 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -201,8 +201,8 @@ static int _git_uploadpack_ls(
t->current_stream = s;
git__free(host);
git__free(port);
- if (user) git__free(user);
- if (pass) git__free(pass);
+ git__free(user);
+ git__free(pass);
return 0;
on_error:
@@ -257,8 +257,8 @@ static int _git_receivepack_ls(
t->current_stream = s;
git__free(host);
git__free(port);
- if (user) git__free(user);
- if (pass) git__free(pass);
+ git__free(user);
+ git__free(pass);
return 0;
on_error: