Skip to content

Commit

Permalink
git: Wrong parsing of ssh urls with IPv6 literals ignores port
Browse files Browse the repository at this point in the history
If we encounter an address part shaped like "[HOST]:PORT", we skip the opening
bracket and replace the closing one with a NUL.  The variable host then points
to HOST and we've cut off the PORT part.  Thus, when we go looking for it using
host a bit later, we can't find it.  Start at end instead, which either points
to the colon, if present, or is equal to host.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Jun 13, 2012
1 parent 121f71f commit 7acf438
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
* Add support for ssh port: ssh://host.xy:<port>/...
*/
if (protocol == PROTO_SSH && host != url)
port = get_port(host);
port = get_port(end);

if (protocol == PROTO_GIT) {
/* These underlying connection commands die() if they
Expand Down

0 comments on commit 7acf438

Please sign in to comment.