| 1006 | } |
| 1007 | |
| 1008 | static struct child_process *git_proxy_connect(int fd[2], char *host) |
| 1009 | { |
| 1010 | const char *port = STR(DEFAULT_GIT_PORT); |
| 1011 | struct child_process *proxy; |
| 1012 | |
| 1013 | get_host_and_port(&host, &port); |
| 1014 | |
| 1015 | if (looks_like_command_line_option(host)) |
| 1016 | die(_("strange hostname '%s' blocked"), host); |
| 1017 | if (looks_like_command_line_option(port)) |
| 1018 | die(_("strange port '%s' blocked"), port); |
| 1019 | |
| 1020 | proxy = xmalloc(sizeof(*proxy)); |
| 1021 | child_process_init(proxy); |
| 1022 | strvec_push(&proxy->args, git_proxy_command); |
| 1023 | strvec_push(&proxy->args, host); |
| 1024 | strvec_push(&proxy->args, port); |
| 1025 | proxy->in = -1; |
| 1026 | proxy->out = -1; |
| 1027 | if (start_command(proxy)) |
| 1028 | die(_("cannot start proxy %s"), git_proxy_command); |
| 1029 | fd[0] = proxy->out; /* read from proxy stdout */ |
| 1030 | fd[1] = proxy->in; /* write to proxy stdin */ |
| 1031 | return proxy; |
| 1032 | } |
| 1033 | |
| 1034 | static char *get_port(char *host) |
| 1035 | { |
no test coverage detected