aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-13 22:55:59 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-13 22:55:59 -0700
commitc722ba4814f34d02faed305e4cc6498c783543a9 (patch)
treecdf6603541229f3878ac3a8b70e88bf34f5aba69 /connect.c
parent1165ae6f3d42e0eb0ddfc2d4e6dfa8bd0b88eb60 (diff)
parentb48537305229d1a4f25633f71941ee52d2582017 (diff)
downloadgit-c722ba4814f34d02faed305e4cc6498c783543a9.tar.gz
git-c722ba4814f34d02faed305e4cc6498c783543a9.tar.xz
Merge branch 'jk/daemon-interpolate' into maint
The "interpolated-path" option of "git daemon" inserted any string client declared on the "host=" capability request without checking. Sanitize and limit %H and %CH to a saner and a valid DNS name. * jk/daemon-interpolate: daemon: sanitize incoming virtual hostname t5570: test git-daemon's --interpolated-path option git_connect: let user override virtual-host we send to daemon
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 2a5c40049..d50f52ad8 100644
--- a/connect.c
+++ b/connect.c
@@ -669,10 +669,20 @@ struct child_process *git_connect(int fd[2], const char *url,
printf("Diag: path=%s\n", path ? path : "NULL");
conn = NULL;
} else if (protocol == PROTO_GIT) {
+ /*
+ * Set up virtual host information based on where we will
+ * connect, unless the user has overridden us in
+ * the environment.
+ */
+ char *target_host = getenv("GIT_OVERRIDE_VIRTUAL_HOST");
+ if (target_host)
+ target_host = xstrdup(target_host);
+ else
+ target_host = xstrdup(hostandport);
+
/* These underlying connection commands die() if they
* cannot connect.
*/
- char *target_host = xstrdup(hostandport);
if (git_use_proxy(hostandport))
conn = git_proxy_connect(fd, hostandport);
else