version 1.440, 2016/05/04 14:29:58 |
version 1.441, 2016/06/03 03:14:41 |
|
|
*/ |
*/ |
int fork_after_authentication_flag = 0; |
int fork_after_authentication_flag = 0; |
|
|
/* forward stdio to remote host and port */ |
|
char *stdio_forward_host = NULL; |
|
int stdio_forward_port = 0; |
|
|
|
/* |
/* |
* General data structure for command line options and options configurable |
* General data structure for command line options and options configurable |
* in configuration files. See readconf.h. |
* in configuration files. See readconf.h. |
|
|
options.fwd_opts.gateway_ports = 1; |
options.fwd_opts.gateway_ports = 1; |
break; |
break; |
case 'O': |
case 'O': |
if (stdio_forward_host != NULL) |
if (options.stdio_forward_host != NULL) |
fatal("Cannot specify multiplexing " |
fatal("Cannot specify multiplexing " |
"command with -W"); |
"command with -W"); |
else if (muxclient_command != 0) |
else if (muxclient_command != 0) |
|
|
} |
} |
break; |
break; |
case 'W': |
case 'W': |
if (stdio_forward_host != NULL) |
if (options.stdio_forward_host != NULL) |
fatal("stdio forward already specified"); |
fatal("stdio forward already specified"); |
if (muxclient_command != 0) |
if (muxclient_command != 0) |
fatal("Cannot specify stdio forward with -O"); |
fatal("Cannot specify stdio forward with -O"); |
if (parse_forward(&fwd, optarg, 1, 0)) { |
if (parse_forward(&fwd, optarg, 1, 0)) { |
stdio_forward_host = fwd.listen_host; |
options.stdio_forward_host = fwd.listen_host; |
stdio_forward_port = fwd.listen_port; |
options.stdio_forward_port = fwd.listen_port; |
free(fwd.connect_host); |
free(fwd.connect_host); |
} else { |
} else { |
fprintf(stderr, |
fprintf(stderr, |
|
|
Channel *c; |
Channel *c; |
int in, out; |
int in, out; |
|
|
if (stdio_forward_host == NULL) |
if (options.stdio_forward_host == NULL) |
return; |
return; |
if (!compat20) |
if (!compat20) |
fatal("stdio forwarding require Protocol 2"); |
fatal("stdio forwarding require Protocol 2"); |
|
|
debug3("%s: %s:%d", __func__, stdio_forward_host, stdio_forward_port); |
debug3("%s: %s:%d", __func__, options.stdio_forward_host, |
|
options.stdio_forward_port); |
|
|
if ((in = dup(STDIN_FILENO)) < 0 || |
if ((in = dup(STDIN_FILENO)) < 0 || |
(out = dup(STDOUT_FILENO)) < 0) |
(out = dup(STDOUT_FILENO)) < 0) |
fatal("channel_connect_stdio_fwd: dup() in/out failed"); |
fatal("channel_connect_stdio_fwd: dup() in/out failed"); |
if ((c = channel_connect_stdio_fwd(stdio_forward_host, |
if ((c = channel_connect_stdio_fwd(options.stdio_forward_host, |
stdio_forward_port, in, out)) == NULL) |
options.stdio_forward_port, in, out)) == NULL) |
fatal("%s: channel_connect_stdio_fwd failed", __func__); |
fatal("%s: channel_connect_stdio_fwd failed", __func__); |
channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); |
channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); |
channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL); |
channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL); |