]> andersk Git - openssh.git/blobdiff - canohost.c
20070326
[openssh.git] / canohost.c
index bd7f830dea4590f97071f5b9473303279740c4b2..2345cc35c3154b35ab36e09325951305b6178f9c 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenBSD: canohost.c,v 1.61 2006/08/03 03:34:41 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: canohost.c,v 1.47 2005/11/03 13:38:29 dtucker Exp $");
 
-#include "packet.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
 #include "xmalloc.h"
+#include "packet.h"
 #include "log.h"
 #include "canohost.h"
 
@@ -43,6 +57,9 @@ get_remote_hostname(int sock, int use_dns)
                cleanup_exit(255);
        }
 
+       if (from.ss_family == AF_INET)
+               check_ip_options(sock, ntop);
+
        ipv64_normalise_mapped(&from, &fromlen);
 
        if (from.ss_family == AF_INET6)
@@ -52,9 +69,6 @@ get_remote_hostname(int sock, int use_dns)
            NULL, 0, NI_NUMERICHOST) != 0)
                fatal("get_remote_hostname: getnameinfo NI_NUMERICHOST failed");
 
-       if (from.ss_family == AF_INET)
-               check_ip_options(sock, ntop);
-
        if (!use_dns)
                return xstrdup(ntop);
 
@@ -87,7 +101,7 @@ get_remote_hostname(int sock, int use_dns)
         */
        for (i = 0; name[i]; i++)
                if (isupper(name[i]))
-                       name[i] = tolower(name[i]);
+                       name[i] = (char)tolower(name[i]);
        /*
         * Map it back to an IP address and check that the given
         * address actually is an address of this host.  This is
@@ -102,7 +116,7 @@ get_remote_hostname(int sock, int use_dns)
        hints.ai_socktype = SOCK_STREAM;
        if (getaddrinfo(name, NULL, &hints, &aitop) != 0) {
                logit("reverse mapping checking getaddrinfo for %.700s "
-                   "failed - POSSIBLE BREAKIN ATTEMPT!", name);
+                   "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop);
                return xstrdup(ntop);
        }
        /* Look for the address from the list of addresses. */
@@ -117,7 +131,7 @@ get_remote_hostname(int sock, int use_dns)
        if (!ai) {
                /* Address not found for the host name. */
                logit("Address %.100s maps to %.600s, but this does not "
-                   "map back to the address - POSSIBLE BREAKIN ATTEMPT!",
+                   "map back to the address - POSSIBLE BREAK-IN ATTEMPT!",
                    ntop, name);
                return xstrdup(ntop);
        }
This page took 0.066406 seconds and 4 git commands to generate.