summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2019-02-01 03:52:23 +0000
committerDarren Tucker <dtucker@dtucker.net>2019-02-01 18:55:11 +1100
commit483b3b638500fd498b4b529356e5a0e18cf76891 (patch)
tree4b89f79f701027ab6d2cfcbc5d0f8aab81896496 /sshconnect.c
parent5f004620fdc1b2108139300ee12f4014530fb559 (diff)
downloadopenssh-git-483b3b638500fd498b4b529356e5a0e18cf76891.tar.gz
upstream: Save connection timeout and restore for 2nd and
subsequent attempts, preventing them from having no timeout. bz#2918, ok djm@ OpenBSD-Commit-ID: 4977f1d0521d9b6bba0c9a20d3d226cefac48292
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 955671b4..eb5139fc 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.312 2019/01/24 17:00:29 dtucker Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.313 2019/02/01 03:52:23 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -457,7 +457,7 @@ ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,
struct sockaddr_storage *hostaddr, u_short port, int family,
int connection_attempts, int *timeout_ms, int want_keepalive)
{
- int on = 1;
+ int on = 1, saved_timeout_ms = *timeout_ms;
int oerrno, sock = -1, attempt;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
struct addrinfo *ai;
@@ -501,6 +501,7 @@ ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,
continue;
}
+ *timeout_ms = saved_timeout_ms;
if (timeout_connect(sock, ai->ai_addr, ai->ai_addrlen,
timeout_ms) >= 0) {
/* Successful connection. */