summaryrefslogtreecommitdiffhomepage
path: root/cli-main.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-12-18 21:20:46 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-12-18 21:20:46 +0800
commit4c4aa502d4a65b90a86de6c1af868984565f1fe2 (patch)
treeff2ae17e087d8edc0d0f2e0d8450a770762da6b8 /cli-main.c
parent20bdf3a5b1a1227b55a94830e5046b68b5ebc60c (diff)
use exec for proxycommand
Diffstat (limited to 'cli-main.c')
-rw-r--r--cli-main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/cli-main.c b/cli-main.c
index c2fd729..787d770 100644
--- a/cli-main.c
+++ b/cli-main.c
@@ -152,12 +152,19 @@ static void exec_proxy_cmd(void *user_data_cmd) {
#ifdef ENABLE_CLI_PROXYCMD
static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
+ char * ex_cmd = NULL;
+ size_t ex_cmdlen;
int ret;
fill_passwd(cli_opts.own_user);
- ret = spawn_command(exec_proxy_cmd, cli_opts.proxycmd,
+ ex_cmdlen = strlen(cli_opts.proxycmd) + 6; /* "exec " + command + '\0' */
+ ex_cmd = m_malloc(ex_cmdlen);
+ snprintf(ex_cmd, ex_cmdlen, "exec %s", cli_opts.proxycmd);
+
+ ret = spawn_command(exec_proxy_cmd, ex_cmd,
sock_out, sock_in, NULL, pid_out);
+ m_free(ex_cmd);
if (ret == DROPBEAR_FAILURE) {
dropbear_exit("Failed running proxy command");
*sock_in = *sock_out = -1;