summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshconnect.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2000-06-17 19:24:34 +0000
committermarkus <markus@openbsd.org>2000-06-17 19:24:34 +0000
commit248076d5530b1e94686a091d7d7dfb9760bf5d81 (patch)
tree8bb0cc00687443f19d4d66d2ef3629c13ae1d815 /usr.bin/ssh/sshconnect.c
parent-o force is not a negative option, it should set MNT_FORCE, not clear it. OK millert (diff)
downloadwireguard-openbsd-248076d5530b1e94686a091d7d7dfb9760bf5d81.tar.xz
wireguard-openbsd-248076d5530b1e94686a091d7d7dfb9760bf5d81.zip
allow extended server banners
Diffstat (limited to 'usr.bin/ssh/sshconnect.c')
-rw-r--r--usr.bin/ssh/sshconnect.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c
index 2e54651ea9b..e0e073c8ca1 100644
--- a/usr.bin/ssh/sshconnect.c
+++ b/usr.bin/ssh/sshconnect.c
@@ -8,7 +8,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.74 2000/05/17 16:57:02 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.75 2000/06/17 19:24:34 markus Exp $");
#include <openssl/bn.h>
#include <openssl/dsa.h>
@@ -310,23 +310,28 @@ ssh_exchange_identification()
int connection_out = packet_get_connection_out();
/* Read other side\'s version identification. */
- for (i = 0; i < sizeof(buf) - 1; i++) {
- int len = read(connection_in, &buf[i], 1);
- if (len < 0)
- fatal("ssh_exchange_identification: read: %.100s", strerror(errno));
- if (len != 1)
- fatal("ssh_exchange_identification: Connection closed by remote host");
- if (buf[i] == '\r') {
- buf[i] = '\n';
- buf[i + 1] = 0;
- continue; /**XXX wait for \n */
+ for (;;) {
+ for (i = 0; i < sizeof(buf) - 1; i++) {
+ int len = read(connection_in, &buf[i], 1);
+ if (len < 0)
+ fatal("ssh_exchange_identification: read: %.100s", strerror(errno));
+ if (len != 1)
+ fatal("ssh_exchange_identification: Connection closed by remote host");
+ if (buf[i] == '\r') {
+ buf[i] = '\n';
+ buf[i + 1] = 0;
+ continue; /**XXX wait for \n */
+ }
+ if (buf[i] == '\n') {
+ buf[i + 1] = 0;
+ break;
+ }
}
- if (buf[i] == '\n') {
- buf[i + 1] = 0;
+ buf[sizeof(buf) - 1] = 0;
+ if (strncmp(buf, "SSH-", 4))
break;
- }
+ debug("ssh_exchange_identification: %s", buf);
}
- buf[sizeof(buf) - 1] = 0;
server_version_string = xstrdup(buf);
/*