summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/ssh-keyscan.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2006-03-22 20:41:37 +0000
committerdes <des@FreeBSD.org>2006-03-22 20:41:37 +0000
commit7c07891caf91823c65d0ed7f700a1cfe983e15cc (patch)
treefb276a713da5dc24fdafffe04d15c0de14e138e2 /crypto/openssh/ssh-keyscan.c
parentc2efe9a3053e865e5c7bf36de808ec154ddb8c36 (diff)
downloadFreeBSD-src-7c07891caf91823c65d0ed7f700a1cfe983e15cc.zip
FreeBSD-src-7c07891caf91823c65d0ed7f700a1cfe983e15cc.tar.gz
Merge conflicts.
Diffstat (limited to 'crypto/openssh/ssh-keyscan.c')
-rw-r--r--crypto/openssh/ssh-keyscan.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/crypto/openssh/ssh-keyscan.c b/crypto/openssh/ssh-keyscan.c
index 46f0636..6915102 100644
--- a/crypto/openssh/ssh-keyscan.c
+++ b/crypto/openssh/ssh-keyscan.c
@@ -7,7 +7,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keyscan.c,v 1.55 2005/06/17 02:44:33 djm Exp $");
+RCSID("$OpenBSD: ssh-keyscan.c,v 1.57 2005/10/30 04:01:03 djm Exp $");
#include "openbsd-compat/sys-queue.h"
@@ -499,12 +499,18 @@ congreet(int s)
size_t bufsiz;
con *c = &fdcon[s];
- bufsiz = sizeof(buf);
- cp = buf;
- while (bufsiz-- && (n = atomicio(read, s, cp, 1)) == 1 && *cp != '\n') {
- if (*cp == '\r')
- *cp = '\n';
- cp++;
+ for (;;) {
+ memset(buf, '\0', sizeof(buf));
+ bufsiz = sizeof(buf);
+ cp = buf;
+ while (bufsiz-- &&
+ (n = atomicio(read, s, cp, 1)) == 1 && *cp != '\n') {
+ if (*cp == '\r')
+ *cp = '\n';
+ cp++;
+ }
+ if (n != 1 || strncmp(buf, "SSH-", 4) == 0)
+ break;
}
if (n == 0) {
switch (errno) {
@@ -712,6 +718,9 @@ main(int argc, char **argv)
seed_rng();
TAILQ_INIT(&tq);
+ /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
+ sanitise_stdfd();
+
if (argc <= 1)
usage();
OpenPOWER on IntegriCloud