From: Stefan Sperling Subject: dial fix for git-shell To: gameoftrees@openbsd.org Date: Sat, 18 Feb 2023 15:30:59 +0100 This might be needed to make 'got clone' and 'got fetch' work for people who use git-shell as a login shell. pass git-{upload,receive}-pack and repository path as one argument to ssh(1) diff f990756a3987ba6410baf611d561e9b8f285f047 0e404353fff14a28970780ae0186de8ba3970065 commit - f990756a3987ba6410baf611d561e9b8f285f047 commit + 0e404353fff14a28970780ae0186de8ba3970065 blob - 3325c8994f55721d8588155cdc72b95d11fd2248 blob + 5c7a181aadeac8d26c1278d0539a8f0646d2e517 --- lib/dial.c +++ lib/dial.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "got_error.h" #include "got_path.h" @@ -206,8 +207,8 @@ got_dial_ssh(pid_t *newpid, int *newfd, const char *ho { const struct got_error *error = NULL; int pid, pfd[2]; - char cmd[64]; - const char *argv[11]; + char cmd[64 + PATH_MAX]; + const char *argv[10]; int i = 0, j; *newpid = -1; @@ -228,7 +229,6 @@ got_dial_ssh(pid_t *newpid, int *newfd, const char *ho argv[i++] = "--"; argv[i++] = (char *)host; argv[i++] = (char *)cmd; - argv[i++] = (char *)path; argv[i++] = NULL; assert(i <= nitems(argv)); @@ -249,7 +249,8 @@ got_dial_ssh(pid_t *newpid, int *newfd, const char *ho err(1, "dup2"); if (dup2(pfd[0], 1) == -1) err(1, "dup2"); - n = snprintf(cmd, sizeof(cmd), "git-%s-pack", direction); + n = snprintf(cmd, sizeof(cmd), "git-%s-pack %s", + direction, path); if (n < 0 || n >= ssizeof(cmd)) err(1, "snprintf"); if (execv(GOT_DIAL_PATH_SSH, (char *const *)argv) == -1)