summaryrefslogtreecommitdiffhomepage
path: root/cli-main.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-26 22:44:48 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-26 22:44:48 +0800
commit5df73215f887bbc4ebd122e725fe5497d92f511f (patch)
tree5eaaab331c7f481b736dcd6d0e526de1e2248a14 /cli-main.c
parent573838a0278e56225bf2a4a1e386105525a6a91a (diff)
parent3996e93a2045b68cbec6d645e7a166358dac95f7 (diff)
merge from main
--HG-- branch : fuzz
Diffstat (limited to 'cli-main.c')
-rw-r--r--cli-main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli-main.c b/cli-main.c
index 09ff496..713cb09 100644
--- a/cli-main.c
+++ b/cli-main.c
@@ -158,6 +158,21 @@ static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
size_t ex_cmdlen;
int ret;
+ /* File descriptor "-j &3" */
+ if (*cli_opts.proxycmd == '&') {
+ char *p = cli_opts.proxycmd + 1;
+ int sock = strtoul(p, &p, 10);
+ /* must be a single number, and not stdin/stdout/stderr */
+ if (sock > 2 && sock < 1024 && *p == '\0') {
+ *sock_in = sock;
+ *sock_out = sock;
+ return;
+ }
+ }
+
+ /* Normal proxycommand */
+
+ /* So that spawn_command knows which shell to run */
fill_passwd(cli_opts.own_user);
ex_cmdlen = strlen(cli_opts.proxycmd) + 6; /* "exec " + command + '\0' */