summaryrefslogtreecommitdiff
path: root/src/transports/git.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-01-31 14:04:21 -0800
committerBen Straub <bs@github.com>2013-01-31 14:04:21 -0800
commitcf7038a65cb080a2946202fe6cbbe52aefae1fd4 (patch)
tree379e3be397c781f7af8e06d89f4fb024bd8c05db /src/transports/git.c
parent7602cb7c0ea0d69efd30640af234be20393bf57c (diff)
downloadlibgit2-cf7038a65cb080a2946202fe6cbbe52aefae1fd4.tar.gz
Enhance url parsing to include passwords
Diffstat (limited to 'src/transports/git.c')
-rw-r--r--src/transports/git.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/transports/git.c b/src/transports/git.c
index 5c816e127..21de4d789 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -179,7 +179,7 @@ static int _git_uploadpack_ls(
const char *url,
git_smart_subtransport_stream **stream)
{
- char *host, *port, *user;
+ char *host, *port, *user, *pass;
git_stream *s;
*stream = NULL;
@@ -192,7 +192,7 @@ static int _git_uploadpack_ls(
s = (git_stream *)*stream;
- if (gitno_extract_host_and_port(&host, &port, &user, url, GIT_DEFAULT_PORT) < 0)
+ if (gitno_extract_url_parts(&host, &port, &user, &pass, url, GIT_DEFAULT_PORT) < 0)
goto on_error;
if (gitno_connect(&s->socket, host, port, 0) < 0)
@@ -202,6 +202,7 @@ static int _git_uploadpack_ls(
git__free(host);
git__free(port);
git__free(user);
+ git__free(pass);
return 0;
on_error:
@@ -234,7 +235,7 @@ static int _git_receivepack_ls(
const char *url,
git_smart_subtransport_stream **stream)
{
- char *host, *port, *user;
+ char *host, *port, *user, *pass;
git_stream *s;
*stream = NULL;
@@ -247,7 +248,7 @@ static int _git_receivepack_ls(
s = (git_stream *)*stream;
- if (gitno_extract_host_and_port(&host, &port, &user, url, GIT_DEFAULT_PORT) < 0)
+ if (gitno_extract_url_parts(&host, &port, &user, &pass, url, GIT_DEFAULT_PORT) < 0)
goto on_error;
if (gitno_connect(&s->socket, host, port, 0) < 0)
@@ -257,6 +258,7 @@ static int _git_receivepack_ls(
git__free(host);
git__free(port);
git__free(user);
+ git__free(pass);
return 0;
on_error: