From 862775c7801d90cdd085b88672aeb29e16e31bc8 Mon Sep 17 00:00:00 2001 From: stevesk Date: Mon, 4 Mar 2002 18:30:23 +0000 Subject: handle connection close during read of protocol version string. fixes erroneous "bad greeting". ok markus@ --- usr.bin/ssh/ssh-keyscan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'usr.bin/ssh/ssh-keyscan.c') diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c index 95b556fc222..5fc53307c3e 100644 --- a/usr.bin/ssh/ssh-keyscan.c +++ b/usr.bin/ssh/ssh-keyscan.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-keyscan.c,v 1.34 2002/02/22 12:20:34 markus Exp $"); +RCSID("$OpenBSD: ssh-keyscan.c,v 1.35 2002/03/04 18:30:23 stevesk Exp $"); #include #include @@ -487,6 +487,11 @@ congreet(int s) conrecycle(s); return; } + if (n == 0) { + error("%s: Connection closed by remote host", c->c_name); + conrecycle(s); + return; + } if (*cp != '\n' && *cp != '\r') { error("%s: bad greeting", c->c_name); confree(s); -- cgit v1.2.3-59-g8ed1b