Skip to content

Commit

Permalink
use exec for proxycommand
Browse files Browse the repository at this point in the history
  • Loading branch information
mkj committed Dec 18, 2015
1 parent 20bdf3a commit 4c4aa50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cli-main.c
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion dbclient.1
Expand Up @@ -114,7 +114,8 @@ Disconnect the session if no traffic is transmitted or received for \fIidle_time
.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
Expand Down

0 comments on commit 4c4aa50

Please sign in to comment.