summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2002-03-04 18:30:24 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2002-03-04 18:30:24 +0000
commit08389aa80adac81cd6a34da4012768c2be8ee05d (patch)
tree734a0d0e3e5805a7c4f5feef96835abea09e2d82
parent940a09247d4585071527443813abef716c5636c1 (diff)
handle connection close during read of protocol version string.
fixes erroneous "bad greeting". ok markus@
-rw-r--r--usr.bin/ssh/ssh-keyscan.c7
1 files changed, 6 insertions, 1 deletions
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 <sys/queue.h>
#include <errno.h>
@@ -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);