diff options
-rw-r--r-- | sshconnect.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sshconnect.c b/sshconnect.c index eb5139fc7..fdcdcd855 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect.c,v 1.313 2019/02/01 03:52:23 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect.c,v 1.314 2019/02/27 19:37:01 markus 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 |
@@ -547,12 +547,20 @@ ssh_connect(struct ssh *ssh, const char *host, struct addrinfo *addrs, | |||
547 | struct sockaddr_storage *hostaddr, u_short port, int family, | 547 | struct sockaddr_storage *hostaddr, u_short port, int family, |
548 | int connection_attempts, int *timeout_ms, int want_keepalive) | 548 | int connection_attempts, int *timeout_ms, int want_keepalive) |
549 | { | 549 | { |
550 | int in, out; | ||
551 | |||
550 | if (options.proxy_command == NULL) { | 552 | if (options.proxy_command == NULL) { |
551 | return ssh_connect_direct(ssh, host, addrs, hostaddr, port, | 553 | return ssh_connect_direct(ssh, host, addrs, hostaddr, port, |
552 | family, connection_attempts, timeout_ms, want_keepalive); | 554 | family, connection_attempts, timeout_ms, want_keepalive); |
553 | } else if (strcmp(options.proxy_command, "-") == 0) { | 555 | } else if (strcmp(options.proxy_command, "-") == 0) { |
554 | if ((ssh_packet_set_connection(ssh, | 556 | if ((in = dup(STDIN_FILENO)) < 0 || |
555 | STDIN_FILENO, STDOUT_FILENO)) == NULL) | 557 | (out = dup(STDOUT_FILENO)) < 0) { |
558 | if (in >= 0) | ||
559 | close(in); | ||
560 | error("%s: dup() in/out failed", __func__); | ||
561 | return -1; /* ssh_packet_set_connection logs error */ | ||
562 | } | ||
563 | if ((ssh_packet_set_connection(ssh, in, out)) == NULL) | ||
556 | return -1; /* ssh_packet_set_connection logs error */ | 564 | return -1; /* ssh_packet_set_connection logs error */ |
557 | return 0; | 565 | return 0; |
558 | } else if (options.proxy_use_fdpass) { | 566 | } else if (options.proxy_use_fdpass) { |