]> andersk Git - openssh.git/blobdiff - ssh-keyscan.c
- (tim) [contrib/caldera/openssh.spec] add Requires line for Caldera 3.1
[openssh.git] / ssh-keyscan.c
index ab46e9edbd20b94171be67c12a3d0922816abf79..3f6c23136356437785f234858b73bcb9a1b9e993 100644 (file)
@@ -8,12 +8,12 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-keyscan.c,v 1.19 2001/03/03 21:19:41 millert Exp $");
+RCSID("$OpenBSD: ssh-keyscan.c,v 1.22 2001/03/06 06:11:18 deraadt Exp $");
 
 #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
 #include <sys/queue.h>
 #else
-#include "fake-queue.h"
+#include "openbsd-compat/fake-queue.h"
 #endif
 #include <errno.h>
 
@@ -91,7 +91,7 @@ typedef struct {
        void (*errfun) (const char *,...);
 } Linebuf;
 
-static __inline__ Linebuf *
+Linebuf *
 Linebuf_alloc(const char *filename, void (*errfun) (const char *,...))
 {
        Linebuf *lb;
@@ -125,7 +125,7 @@ Linebuf_alloc(const char *filename, void (*errfun) (const char *,...))
        return (lb);
 }
 
-static __inline__ void
+void
 Linebuf_free(Linebuf * lb)
 {
        fclose(lb->stream);
@@ -133,7 +133,7 @@ Linebuf_free(Linebuf * lb)
        xfree(lb);
 }
 
-static __inline__ void
+void
 Linebuf_restart(Linebuf * lb)
 {
        clearerr(lb->stream);
@@ -141,13 +141,13 @@ Linebuf_restart(Linebuf * lb)
        lb->lineno = 0;
 }
 
-static __inline__ int
+int
 Linebuf_lineno(Linebuf * lb)
 {
        return (lb->lineno);
 }
 
-static __inline__ char *
+char *
 Linebuf_getline(Linebuf * lb)
 {
        int n = 0;
@@ -184,7 +184,7 @@ Linebuf_getline(Linebuf * lb)
        }
 }
 
-static int
+int
 fdlim_get(int hard)
 {
 #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
@@ -203,7 +203,7 @@ fdlim_get(int hard)
 #endif
 }
 
-static int
+int
 fdlim_set(int lim)
 {
 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
@@ -228,7 +228,7 @@ fdlim_set(int lim)
  * separators.  This is the same as the 4.4BSD strsep, but different from the
  * one in the GNU libc.
  */
-static __inline__ char *
+char *
 xstrsep(char **str, const char *delim)
 {
        char *s, *e;
@@ -411,23 +411,27 @@ conrecycle(int s)
 void
 congreet(int s)
 {
-       char buf[80];
-       int n;
+       char buf[80], *cp;
+       size_t bufsiz;
+       int n = 0;
        con *c = &fdcon[s];
 
-       n = read(s, buf, sizeof(buf));
+       bufsiz = sizeof(buf);
+       cp = buf;
+       while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n' && *cp != '\r')
+               cp++;
        if (n < 0) {
                if (errno != ECONNREFUSED)
                        error("read (%s): %s", c->c_name, strerror(errno));
                conrecycle(s);
                return;
        }
-       if (buf[n - 1] != '\n') {
+       if (*cp != '\n' && *cp != '\r') {
                error("%s: bad greeting", c->c_name);
                confree(s);
                return;
        }
-       buf[n - 1] = '\0';
+       *cp = '\0';
        fprintf(stderr, "# %s %s\n", c->c_name, buf);
        n = snprintf(buf, sizeof buf, "SSH-1.5-OpenSSH-keyscan\r\n");
        if (atomicio(write, s, buf, n) != n) {
@@ -574,7 +578,7 @@ nexthost(int argc, char **argv)
        }
 }
 
-static void
+void
 usage(void)
 {
        fatal("usage: %s [-t timeout] { [--] host | -f file } ...", __progname);
This page took 0.121863 seconds and 4 git commands to generate.