From f6723f08e0b54e00f988f58ff0f1d4d8575ee7bd Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 27 Jan 2004 21:21:27 +1100 Subject: [PATCH] - djm@cvs.openbsd.org 2004/01/25 03:49:09 [sshconnect.c] reset nonblocking flag after ConnectTimeout > 0 connect; (bugzilla #785) from jclonguet AT free.fr; ok millert@ --- ChangeLog | 6 +++++- sshconnect.c | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90c575141..de87d774b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ [cipher.c] rename acss@opebsd.org to acss@openssh.org ok deraadt@ + - djm@cvs.openbsd.org 2004/01/25 03:49:09 + [sshconnect.c] + reset nonblocking flag after ConnectTimeout > 0 connect; (bugzilla #785) + from jclonguet AT free.fr; ok millert@ - (djm) [acss.c acss.h cipher-acss.c] Portable support for ACSS if libcrypto lacks it @@ -1754,4 +1758,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.3195 2004/01/27 10:20:59 djm Exp $ +$Id: ChangeLog,v 1.3196 2004/01/27 10:21:27 djm Exp $ diff --git a/sshconnect.c b/sshconnect.c index 80b45c79e..dfeddd39e 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.155 2003/12/09 21:53:37 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.156 2004/01/25 03:49:09 djm Exp $"); #include @@ -231,12 +231,12 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, if (timeout <= 0) return (connect(sockfd, serv_addr, addrlen)); - if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) - return (-1); - + set_nonblock(sockfd); rc = connect(sockfd, serv_addr, addrlen); - if (rc == 0) + if (rc == 0) { + unset_nonblock(sockfd); return (0); + } if (errno != EINPROGRESS) return (-1); @@ -277,6 +277,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, break; } result = 0; + unset_nonblock(sockfd); break; default: /* Should not occur */