X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=daemon.c;h=9326d3a1fa05f4878a21b58a623d07428f7230fe;hb=385cc9d8c44eb5be9d57e630129752a72c0a08c8;hp=a90ab10505a3694de83a0ffd8fc472518f12cf2b;hpb=dd0c5133c6994d2930485c579e701d79df632ded;p=git.git diff --git a/daemon.c b/daemon.c index a90ab1050..9326d3a1f 100644 --- a/daemon.c +++ b/daemon.c @@ -20,15 +20,15 @@ static int reuseaddr; static const char daemon_usage[] = "git daemon [--verbose] [--syslog] [--export-all]\n" -" [--timeout=n] [--init-timeout=n] [--max-connections=n]\n" -" [--strict-paths] [--base-path=path] [--base-path-relaxed]\n" -" [--user-path | --user-path=path]\n" -" [--interpolated-path=path]\n" -" [--reuseaddr] [--detach] [--pid-file=file]\n" -" [--[enable|disable|allow-override|forbid-override]=service]\n" -" [--inetd | [--listen=host_or_ipaddr] [--port=n]\n" -" [--user=user [--group=group]]\n" -" [directory...]"; +" [--timeout=] [--init-timeout=] [--max-connections=]\n" +" [--strict-paths] [--base-path=] [--base-path-relaxed]\n" +" [--user-path | --user-path=]\n" +" [--interpolated-path=]\n" +" [--reuseaddr] [--detach] [--pid-file=]\n" +" [--(enable|disable|allow-override|forbid-override)=]\n" +" [--inetd | [--listen=] [--port=]\n" +" [--user= [--group=]]\n" +" [...]"; /* List of acceptable pathname prefixes */ static char **ok_paths; @@ -141,15 +141,14 @@ static char *path_ok(char *directory) } else if (interpolated_path && saw_extended_args) { struct strbuf expanded_path = STRBUF_INIT; - struct strbuf_expand_dict_entry dict[] = { - { "H", hostname }, - { "CH", canon_hostname }, - { "IP", ip_address }, - { "P", tcp_port }, - { "D", directory }, - { NULL } - }; - + struct strbuf_expand_dict_entry dict[6]; + + dict[0].placeholder = "H"; dict[0].value = hostname; + dict[1].placeholder = "CH"; dict[1].value = canon_hostname; + dict[2].placeholder = "IP"; dict[2].value = ip_address; + dict[3].placeholder = "P"; dict[3].value = tcp_port; + dict[4].placeholder = "D"; dict[4].value = directory; + dict[5].placeholder = NULL; dict[5].value = NULL; if (*dir != '/') { /* Allow only absolute */ logerror("'%s': Non-absolute path denied (interpolated-path active)", dir); @@ -343,7 +342,9 @@ static int upload_pack(void) { /* Timeout as string */ char timeout_buf[64]; - const char *argv[] = { "upload-pack", "--strict", timeout_buf, ".", NULL }; + const char *argv[] = { "upload-pack", "--strict", NULL, ".", NULL }; + + argv[2] = timeout_buf; snprintf(timeout_buf, sizeof timeout_buf, "--timeout=%u", timeout); return run_service_command(argv);