]> andersk Git - openssh.git/blobdiff - canohost.c
- stevesk@cvs.openbsd.org 2008/12/09 22:37:33
[openssh.git] / canohost.c
index 538b141b169495f32f6046ece1da47b77e5152b4..42011fd0acf2996fe09c10b077444fbfe1aae68f 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: canohost.c,v 1.55 2006/07/08 21:47:12 stevesk Exp $ */
+/* $OpenBSD: canohost.c,v 1.63 2008/06/12 00:03:49 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 #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 "packet.h"
 #include "xmalloc.h"
+#include "packet.h"
 #include "log.h"
 #include "canohost.h"
+#include "misc.h"
 
 static void check_ip_options(int, char *);
 
@@ -81,7 +89,7 @@ get_remote_hostname(int sock, int use_dns)
        memset(&hints, 0, sizeof(hints));
        hints.ai_socktype = SOCK_DGRAM; /*dummy*/
        hints.ai_flags = AI_NUMERICHOST;
-       if (getaddrinfo(name, "0", &hints, &ai) == 0) {
+       if (getaddrinfo(name, NULL, &hints, &ai) == 0) {
                logit("Nasty PTR record \"%s\" is set up for %s, ignoring",
                    name, ntop);
                freeaddrinfo(ai);
@@ -264,7 +272,7 @@ get_socket_address(int sock, int remote, int flags)
        if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
            sizeof(ntop), NULL, 0, flags)) != 0) {
                error("get_socket_address: getnameinfo %d failed: %s", flags,
-                   r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
+                   ssh_gai_strerror(r));
                return NULL;
        }
        return xstrdup(ntop);
@@ -365,7 +373,7 @@ get_sock_port(int sock, int local)
        if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
            strport, sizeof(strport), NI_NUMERICSERV)) != 0)
                fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed: %s",
-                   r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
+                   ssh_gai_strerror(r));
        return atoi(strport);
 }
 
This page took 0.039965 seconds and 4 git commands to generate.