# HG changeset patch # User Matt Johnston # Date 1450444846 -28800 # Node ID f7d565054e5f7c7996fc9306c9aaa0dfe5ed4116 # Parent de2e39e94c680b601e9295e986d0687181ab975e use exec for proxycommand diff -r de2e39e94c68 -r f7d565054e5f cli-main.c --- a/cli-main.c Tue Dec 15 22:57:22 2015 +0800 +++ b/cli-main.c Fri Dec 18 21:20:46 2015 +0800 @@ -152,12 +152,19 @@ #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; diff -r de2e39e94c68 -r f7d565054e5f dbclient.1 --- a/dbclient.1 Tue Dec 15 22:57:22 2015 +0800 +++ b/dbclient.1 Fri Dec 18 21:20:46 2015 +0800 @@ -114,7 +114,8 @@ .B \-J \fIproxy_command Use the standard input/output of the program \fIproxy_command\fR rather than using a normal TCP connection. A hostname should be still be provided, as this is used for -comparing saved hostkeys. +comparing saved hostkeys. This command will be executed as "exec proxy_command ..." with the +default shell. .TP .B \-B \fIendhost:endport "Netcat-alike" mode, where Dropbear will connect to the given host, then create a