|
Lines 151-158
int ostdin_null_flag, ono_shell_flag, otty_flag, orequest_tty;
Link Here
|
| 151 |
*/ |
151 |
*/ |
| 152 |
int fork_after_authentication_flag = 0; |
152 |
int fork_after_authentication_flag = 0; |
| 153 |
|
153 |
|
| 154 |
/* forward stdio to remote host and port */ |
154 |
/* forward stdio to remote host and port or unix socket */ |
| 155 |
char *stdio_forward_host = NULL; |
155 |
char *stdio_forward_path = NULL; |
| 156 |
int stdio_forward_port = 0; |
156 |
int stdio_forward_port = 0; |
| 157 |
|
157 |
|
| 158 |
/* |
158 |
/* |
|
Lines 639-645
main(int ac, char **av)
Link Here
|
| 639 |
options.fwd_opts.gateway_ports = 1; |
639 |
options.fwd_opts.gateway_ports = 1; |
| 640 |
break; |
640 |
break; |
| 641 |
case 'O': |
641 |
case 'O': |
| 642 |
if (stdio_forward_host != NULL) |
642 |
if (stdio_forward_path != NULL) |
| 643 |
fatal("Cannot specify multiplexing " |
643 |
fatal("Cannot specify multiplexing " |
| 644 |
"command with -W"); |
644 |
"command with -W"); |
| 645 |
else if (muxclient_command != 0) |
645 |
else if (muxclient_command != 0) |
|
Lines 756-767
main(int ac, char **av)
Link Here
|
| 756 |
} |
756 |
} |
| 757 |
break; |
757 |
break; |
| 758 |
case 'W': |
758 |
case 'W': |
| 759 |
if (stdio_forward_host != NULL) |
759 |
if (stdio_forward_path != NULL) |
| 760 |
fatal("stdio forward already specified"); |
760 |
fatal("stdio forward already specified"); |
| 761 |
if (muxclient_command != 0) |
761 |
if (muxclient_command != 0) |
| 762 |
fatal("Cannot specify stdio forward with -O"); |
762 |
fatal("Cannot specify stdio forward with -O"); |
| 763 |
if (parse_forward(&fwd, optarg, 1, 0)) { |
763 |
if (parse_forward(&fwd, optarg, 1, 0)) { |
| 764 |
stdio_forward_host = fwd.listen_host; |
764 |
stdio_forward_path = ((fwd.listen_port == PORT_STREAMLOCAL) |
|
|
765 |
? fwd.listen_path |
| 766 |
: fwd.listen_host); |
| 765 |
stdio_forward_port = fwd.listen_port; |
767 |
stdio_forward_port = fwd.listen_port; |
| 766 |
free(fwd.connect_host); |
768 |
free(fwd.connect_host); |
| 767 |
} else { |
769 |
} else { |
|
Lines 1493-1509
ssh_init_stdio_forwarding(void)
Link Here
|
| 1493 |
Channel *c; |
1495 |
Channel *c; |
| 1494 |
int in, out; |
1496 |
int in, out; |
| 1495 |
|
1497 |
|
| 1496 |
if (stdio_forward_host == NULL) |
1498 |
if (stdio_forward_path == NULL) |
| 1497 |
return; |
1499 |
return; |
| 1498 |
if (!compat20) |
1500 |
if (!compat20) |
| 1499 |
fatal("stdio forwarding require Protocol 2"); |
1501 |
fatal("stdio forwarding require Protocol 2"); |
| 1500 |
|
1502 |
|
| 1501 |
debug3("%s: %s:%d", __func__, stdio_forward_host, stdio_forward_port); |
1503 |
if (stdio_forward_port == PORT_STREAMLOCAL) |
|
|
1504 |
debug3("%s: stream local %s", __func__, stdio_forward_path); |
| 1505 |
else |
| 1506 |
debug3("%s: %s:%d", __func__, stdio_forward_path, stdio_forward_port); |
| 1502 |
|
1507 |
|
| 1503 |
if ((in = dup(STDIN_FILENO)) < 0 || |
1508 |
if ((in = dup(STDIN_FILENO)) < 0 || |
| 1504 |
(out = dup(STDOUT_FILENO)) < 0) |
1509 |
(out = dup(STDOUT_FILENO)) < 0) |
| 1505 |
fatal("channel_connect_stdio_fwd: dup() in/out failed"); |
1510 |
fatal("channel_connect_stdio_fwd: dup() in/out failed"); |
| 1506 |
if ((c = channel_connect_stdio_fwd(stdio_forward_host, |
1511 |
if ((c = channel_connect_stdio_fwd(stdio_forward_path, |
| 1507 |
stdio_forward_port, in, out)) == NULL) |
1512 |
stdio_forward_port, in, out)) == NULL) |
| 1508 |
fatal("%s: channel_connect_stdio_fwd failed", __func__); |
1513 |
fatal("%s: channel_connect_stdio_fwd failed", __func__); |
| 1509 |
channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); |
1514 |
channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); |
| 1510 |
- |
|
|