]> andersk Git - gssapi-openssh.git/blobdiff - openssh/canohost.c
merged OpenSSH 5.2p1 to trunk
[gssapi-openssh.git] / openssh / canohost.c
index 99da72d41e10d291dc8081ff9881636ea4867fc8..d154ab80d444fd32f4d210545fbfdc7ec813ec2d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: canohost.c,v 1.61 2006/08/03 03:34:41 deraadt Exp $ */
+/* $OpenBSD: canohost.c,v 1.64 2009/02/12 03:00:56 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -16,6 +16,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/param.h>          /* for MAXHOSTNAMELEN */
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -33,6 +34,7 @@
 #include "packet.h"
 #include "log.h"
 #include "canohost.h"
+#include "misc.h"
 
 static void check_ip_options(int, char *);
 
@@ -89,7 +91,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);
@@ -272,7 +274,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);
@@ -342,7 +344,7 @@ get_remote_name_or_ip(u_int utmp_len, int use_dns)
 
 /* Returns the local/remote port for the socket. */
 
-static int
+int
 get_sock_port(int sock, int local)
 {
        struct sockaddr_storage from;
@@ -373,7 +375,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.034689 seconds and 4 git commands to generate.