Merge branch 'jk/daemon-interpolate'
authorJunio C Hamano <gitster@pobox.com>
Tue, 3 Mar 2015 22:37:05 +0000 (14:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Mar 2015 22:37:06 +0000 (14:37 -0800)
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

1  2 
connect.c
daemon.c
diff --cc connect.c
Simple merge
diff --cc daemon.c
index 09fa652fd172cf7bb5b1cf8a4f0ccbc072ca2111,b0b2b5382050edfc7fd7fc2b48e135e02b7fe582..c3edd960ec5bf686b66fa55dcfea712e455fe772
+++ b/daemon.c
@@@ -557,11 -564,10 +596,11 @@@ static void parse_host_arg(char *extra_
                                parse_host_and_port(val, &host, &port);
                                if (port) {
                                        free(tcp_port);
-                                       tcp_port = xstrdup(port);
+                                       tcp_port = sanitize_client(port);
                                }
                                free(hostname);
-                               hostname = xstrdup_tolower(host);
+                               hostname = canonicalize_client(host);
 +                              hostname_lookup_done = 0;
                        }
  
                        /* On to the next one */