summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/ssh.c b/ssh.c
index b86a764f6..97afdcfee 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.331 2010/01/11 01:39:46 dtucker Exp $ */ 1/* $OpenBSD: ssh.c,v 1.332 2010/01/26 01:28:35 djm 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
@@ -319,6 +319,11 @@ main(int ac, char **av)
319 options.gateway_ports = 1; 319 options.gateway_ports = 1;
320 break; 320 break;
321 case 'O': 321 case 'O':
322 if (stdio_forward_host != NULL)
323 fatal("Cannot specify multiplexing "
324 "command with -W");
325 else if (muxclient_command != 0)
326 fatal("Multiplexing command already specified");
322 if (strcmp(optarg, "check") == 0) 327 if (strcmp(optarg, "check") == 0)
323 muxclient_command = SSHMUX_COMMAND_ALIVE_CHECK; 328 muxclient_command = SSHMUX_COMMAND_ALIVE_CHECK;
324 else if (strcmp(optarg, "exit") == 0) 329 else if (strcmp(optarg, "exit") == 0)
@@ -395,6 +400,10 @@ main(int ac, char **av)
395 } 400 }
396 break; 401 break;
397 case 'W': 402 case 'W':
403 if (stdio_forward_host != NULL)
404 fatal("stdio forward already specified");
405 if (muxclient_command != 0)
406 fatal("Cannot specify stdio forward with -O");
398 if (parse_forward(&fwd, optarg, 1, 0)) { 407 if (parse_forward(&fwd, optarg, 1, 0)) {
399 stdio_forward_host = fwd.listen_host; 408 stdio_forward_host = fwd.listen_host;
400 stdio_forward_port = fwd.listen_port; 409 stdio_forward_port = fwd.listen_port;
@@ -902,11 +911,18 @@ static int
902client_setup_stdio_fwd(const char *host_to_connect, u_short port_to_connect) 911client_setup_stdio_fwd(const char *host_to_connect, u_short port_to_connect)
903{ 912{
904 Channel *c; 913 Channel *c;
914 int in, out;
905 915
906 debug3("client_setup_stdio_fwd %s:%d", host_to_connect, 916 debug3("client_setup_stdio_fwd %s:%d", host_to_connect,
907 port_to_connect); 917 port_to_connect);
908 if ((c = channel_connect_stdio_fwd(host_to_connect, port_to_connect)) 918
909 == NULL) 919 in = dup(STDIN_FILENO);
920 out = dup(STDOUT_FILENO);
921 if (in < 0 || out < 0)
922 fatal("channel_connect_stdio_fwd: dup() in/out failed");
923
924 if ((c = channel_connect_stdio_fwd(host_to_connect, port_to_connect,
925 in, out)) == NULL)
910 return 0; 926 return 0;
911 channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0); 927 channel_register_cleanup(c->self, client_cleanup_stdio_fwd, 0);
912 return 1; 928 return 1;