summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 07703cf77..b79cead5d 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.162 2005/03/10 22:01:06 deraadt Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.163 2005/05/24 17:32:44 avsm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -426,14 +426,15 @@ ssh_exchange_identification(void)
426 int connection_out = packet_get_connection_out(); 426 int connection_out = packet_get_connection_out();
427 int minor1 = PROTOCOL_MINOR_1; 427 int minor1 = PROTOCOL_MINOR_1;
428 428
429 /* Read other side\'s version identification. */ 429 /* Read other side's version identification. */
430 for (;;) { 430 for (;;) {
431 for (i = 0; i < sizeof(buf) - 1; i++) { 431 for (i = 0; i < sizeof(buf) - 1; i++) {
432 int len = atomicio(read, connection_in, &buf[i], 1); 432 size_t len = atomicio(read, connection_in, &buf[i], 1);
433 if (len < 0) 433
434 fatal("ssh_exchange_identification: read: %.100s", strerror(errno)); 434 if (len != 1 && errno == EPIPE)
435 if (len != 1)
436 fatal("ssh_exchange_identification: Connection closed by remote host"); 435 fatal("ssh_exchange_identification: Connection closed by remote host");
436 else if (len != 1)
437 fatal("ssh_exchange_identification: read: %.100s", strerror(errno));
437 if (buf[i] == '\r') { 438 if (buf[i] == '\r') {
438 buf[i] = '\n'; 439 buf[i] = '\n';
439 buf[i + 1] = 0; 440 buf[i + 1] = 0;