summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 5a992515e..3f8c5b403 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include "includes.h" 9#include "includes.h"
10RCSID("$OpenBSD: ssh-keyscan.c,v 1.26 2001/08/05 23:18:20 markus Exp $"); 10RCSID("$OpenBSD: ssh-keyscan.c,v 1.27 2001/08/05 23:29:58 markus Exp $");
11 11
12#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) 12#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
13#include <sys/queue.h> 13#include <sys/queue.h>
@@ -499,8 +499,11 @@ congreet(int s)
499 499
500 bufsiz = sizeof(buf); 500 bufsiz = sizeof(buf);
501 cp = buf; 501 cp = buf;
502 while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n' && *cp != '\r') 502 while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n') {
503 if (*cp == '\r')
504 *cp = '\n';
503 cp++; 505 cp++;
506 }
504 if (n < 0) { 507 if (n < 0) {
505 if (errno != ECONNREFUSED) 508 if (errno != ECONNREFUSED)
506 error("read (%s): %s", c->c_name, strerror(errno)); 509 error("read (%s): %s", c->c_name, strerror(errno));
@@ -513,7 +516,6 @@ congreet(int s)
513 return; 516 return;
514 } 517 }
515 *cp = '\0'; 518 *cp = '\0';
516 fprintf(stderr, "# %s %s\n", c->c_name, buf);
517 if (c->c_keytype != KT_RSA1) { 519 if (c->c_keytype != KT_RSA1) {
518 int remote_major, remote_minor; 520 int remote_major, remote_minor;
519 char remote_version[sizeof buf]; 521 char remote_version[sizeof buf];
@@ -529,6 +531,7 @@ congreet(int s)
529 return; 531 return;
530 } 532 }
531 } 533 }
534 fprintf(stderr, "# %s %s\n", c->c_name, chop(buf));
532 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n", 535 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",
533 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2, 536 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2,
534 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2); 537 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2);