diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.440 2016/05/04 14:29:58 markus Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.441 2016/06/03 03:14:41 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -151,10 +151,6 @@ int ostdin_null_flag, ono_shell_flag, otty_flag, orequest_tty; | |||
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 */ | ||
155 | char *stdio_forward_host = NULL; | ||
156 | int stdio_forward_port = 0; | ||
157 | |||
158 | /* | 154 | /* |
159 | * General data structure for command line options and options configurable | 155 | * General data structure for command line options and options configurable |
160 | * in configuration files. See readconf.h. | 156 | * in configuration files. See readconf.h. |
@@ -651,7 +647,7 @@ main(int ac, char **av) | |||
651 | options.fwd_opts.gateway_ports = 1; | 647 | options.fwd_opts.gateway_ports = 1; |
652 | break; | 648 | break; |
653 | case 'O': | 649 | case 'O': |
654 | if (stdio_forward_host != NULL) | 650 | if (options.stdio_forward_host != NULL) |
655 | fatal("Cannot specify multiplexing " | 651 | fatal("Cannot specify multiplexing " |
656 | "command with -W"); | 652 | "command with -W"); |
657 | else if (muxclient_command != 0) | 653 | else if (muxclient_command != 0) |
@@ -770,13 +766,13 @@ main(int ac, char **av) | |||
770 | } | 766 | } |
771 | break; | 767 | break; |
772 | case 'W': | 768 | case 'W': |
773 | if (stdio_forward_host != NULL) | 769 | if (options.stdio_forward_host != NULL) |
774 | fatal("stdio forward already specified"); | 770 | fatal("stdio forward already specified"); |
775 | if (muxclient_command != 0) | 771 | if (muxclient_command != 0) |
776 | fatal("Cannot specify stdio forward with -O"); | 772 | fatal("Cannot specify stdio forward with -O"); |
777 | if (parse_forward(&fwd, optarg, 1, 0)) { | 773 | if (parse_forward(&fwd, optarg, 1, 0)) { |
778 | stdio_forward_host = fwd.listen_host; | 774 | options.stdio_forward_host = fwd.listen_host; |
779 | stdio_forward_port = fwd.listen_port; | 775 | options.stdio_forward_port = fwd.listen_port; |
780 | free(fwd.connect_host); | 776 | free(fwd.connect_host); |
781 | } else { | 777 | } else { |
782 | fprintf(stderr, | 778 | fprintf(stderr, |
@@ -1538,18 +1534,19 @@ ssh_init_stdio_forwarding(void) | |||
1538 | Channel *c; | 1534 | Channel *c; |
1539 | int in, out; | 1535 | int in, out; |
1540 | 1536 | ||
1541 | if (stdio_forward_host == NULL) | 1537 | if (options.stdio_forward_host == NULL) |
1542 | return; | 1538 | return; |
1543 | if (!compat20) | 1539 | if (!compat20) |
1544 | fatal("stdio forwarding require Protocol 2"); | 1540 | fatal("stdio forwarding require Protocol 2"); |
1545 | 1541 | ||
1546 | debug3("%s: %s:%d", __func__, stdio_forward_host, stdio_forward_port); | 1542 | debug3("%s: %s:%d", __func__, options.stdio_forward_host, |
1543 | options.stdio_forward_port); | ||
1547 | 1544 | ||
1548 | if ((in = dup(STDIN_FILENO)) < 0 || | 1545 | if ((in = dup(STDIN_FILENO)) < 0 || |
1549 | (out = dup(STDOUT_FILENO)) < 0) | 1546 | (out = dup(STDOUT_FILENO)) < 0) |
1550 | fatal("channel_connect_stdio_fwd: dup() in/out failed"); | 1547 | fatal("channel_connect_stdio_fwd: dup() in/out failed"); |
1551 | if ((c = channel_connect_stdio_fwd(stdio_forward_host, | 1548 | if ((c = channel_connect_stdio_fwd(options.stdio_forward_host, |
1552 | stdio_forward_port, in, out)) == NULL) | 1549 | options.stdio_forward_port, in, out)) == NULL) |
1553 | fatal("%s: channel_connect_stdio_fwd failed", __func__); | 1550 | fatal("%s: channel_connect_stdio_fwd failed", __func__); |
1554 | channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); | 1551 | channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); |
1555 | channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL); | 1552 | channel_register_open_confirm(c->self, ssh_stdio_confirm, NULL); |