diff options
author | Matt Johnston <matt@ucc.asn.au> | 2018-02-18 15:12:15 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2018-02-18 15:12:15 +0800 |
commit | 1656db9e58e7e8188e4ca27ae4892b14949c56a5 (patch) | |
tree | 5bad3dbe30955cedc2acd5bfee1575aa140f2824 /cli-main.c | |
parent | 802dace05e8bce06bf4c7df9faadba779d60bb82 (diff) |
Add dbclient '-J &fd' option for a file descriptor
Based on patch by Harald Becker
Diffstat (limited to 'cli-main.c')
-rw-r--r-- | cli-main.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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' */ |