summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/canohost.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2005-06-05 15:46:09 +0000
committerdes <des@FreeBSD.org>2005-06-05 15:46:09 +0000
commit983ad11a1c78949e86a0f51f51ef0d614cc5e665 (patch)
tree7d41ca8690f59b7463bd4d5fefde78dac8a00e60 /crypto/openssh/canohost.c
parent3c5bc6b274083ffa3a7aa67e87c8936a1778eff5 (diff)
downloadFreeBSD-src-983ad11a1c78949e86a0f51f51ef0d614cc5e665.zip
FreeBSD-src-983ad11a1c78949e86a0f51f51ef0d614cc5e665.tar.gz
Resolve conflicts.
Diffstat (limited to 'crypto/openssh/canohost.c')
-rw-r--r--crypto/openssh/canohost.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/crypto/openssh/canohost.c b/crypto/openssh/canohost.c
index 8ad684d..94d6664 100644
--- a/crypto/openssh/canohost.c
+++ b/crypto/openssh/canohost.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $");
+RCSID("$OpenBSD: canohost.c,v 1.42 2005/02/18 03:05:53 djm Exp $");
#include "packet.h"
#include "xmalloc.h"
@@ -20,7 +20,6 @@ RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $");
#include "canohost.h"
static void check_ip_options(int, char *);
-static void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *);
/*
* Return the canonical name of the host at the other end of the socket. The
@@ -166,7 +165,7 @@ check_ip_options(int sock, char *ipaddr)
#endif /* IP_OPTIONS */
}
-static void
+void
ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len)
{
struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)addr;
@@ -232,6 +231,7 @@ get_socket_address(int sock, int remote, int flags)
struct sockaddr_storage addr;
socklen_t addrlen;
char ntop[NI_MAXHOST];
+ int r;
/* Get IP address of client. */
addrlen = sizeof(addr);
@@ -251,10 +251,13 @@ get_socket_address(int sock, int remote, int flags)
if (addr.ss_family == AF_INET6)
addrlen = sizeof(struct sockaddr_in6);
+ ipv64_normalise_mapped(&addr, &addrlen);
+
/* Get the address in ascii. */
- if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop),
- NULL, 0, flags) != 0) {
- error("get_socket_address: getnameinfo %d failed", 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));
return NULL;
}
return xstrdup(ntop);
@@ -330,6 +333,7 @@ get_sock_port(int sock, int local)
struct sockaddr_storage from;
socklen_t fromlen;
char strport[NI_MAXSERV];
+ int r;
/* Get IP address of client. */
fromlen = sizeof(from);
@@ -351,9 +355,10 @@ get_sock_port(int sock, int local)
fromlen = sizeof(struct sockaddr_in6);
/* Return port number. */
- if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
- strport, sizeof(strport), NI_NUMERICSERV) != 0)
- fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed");
+ 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));
return atoi(strport);
}
OpenPOWER on IntegriCloud