]> andersk Git - openssh.git/blobdiff - misc.c
- (tim) [defines.h] Fix regression in long password support on OpenServer 6.
[openssh.git] / misc.c
diff --git a/misc.c b/misc.c
index 158d4878f774a3e9b8998be9f684f0040a54db49..625a34368f425e676564a26c8b63a5ccb32c11a3 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.52 2006/03/30 09:58:15 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.65 2006/11/23 01:35:11 ray Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2005,2006 Damien Miller.  All rights reserved.
 
 #include "includes.h"
 
+#include <sys/types.h>
 #include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <netinet/in.h>
 #include <netinet/tcp.h>
+
+#include <errno.h>
+#include <fcntl.h>
 #ifdef HAVE_PATHS_H
 # include <paths.h>
+#include <pwd.h>
 #endif
 #ifdef SSH_TUN_OPENBSD
 #include <net/if.h>
 #endif
 
+#include "xmalloc.h"
 #include "misc.h"
 #include "log.h"
-#include "xmalloc.h"
+#include "ssh.h"
 
 /* remove newline at end of string */
 char *
@@ -329,6 +345,23 @@ convtime(const char *s)
        return total;
 }
 
+/*
+ * Returns a standardized host+port identifier string.
+ * Caller must free returned string.
+ */
+char *
+put_host_port(const char *host, u_short port)
+{
+       char *hoststr;
+
+       if (port == 0 || port == SSH_DEFAULT_PORT)
+               return(xstrdup(host));
+       if (asprintf(&hoststr, "[%s]:%d", host, (int)port) < 0)
+               fatal("put_host_port: asprintf: %s", strerror(errno));
+       debug3("put_host_port: %s", hoststr);
+       return hoststr;
+}
+
 /*
  * Search for next delimiter between hostnames/addresses and ports.
  * Argument may be modified (for termination).
@@ -583,6 +616,8 @@ read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz,
    u_long *lineno)
 {
        while (fgets(buf, bufsz, f) != NULL) {
+               if (buf[0] == '\0')
+                       continue;
                (*lineno)++;
                if (buf[strlen(buf) - 1] == '\n' || feof(f)) {
                        return 0;
This page took 0.034569 seconds and 4 git commands to generate.