diff options
author | Colin Watson <cjwatson@debian.org> | 2015-08-19 14:23:50 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2015-08-19 14:23:50 +0100 |
commit | baccdb349b31c47cd76fb63211f754ed33a9707e (patch) | |
tree | d03653f975fd4eb8bf71bb0c9d168614401202fa /canohost.c | |
parent | 487bdb3a5ef6075887b830ccb8a0b14f6da78e93 (diff) | |
parent | 9f82e5a9042f2d872e98f48a876fcab3e25dd9bb (diff) |
Import openssh_6.8p1.orig.tar.gz
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/canohost.c b/canohost.c index a3e3bbff8..223964ea3 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.c,v 1.71 2014/07/15 15:54:14 millert Exp $ */ | 1 | /* $OpenBSD: canohost.c,v 1.72 2015/03/01 15:44:40 millert Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -260,24 +260,29 @@ get_socket_address(int sock, int remote, int flags) | |||
260 | } | 260 | } |
261 | 261 | ||
262 | /* Work around Linux IPv6 weirdness */ | 262 | /* Work around Linux IPv6 weirdness */ |
263 | if (addr.ss_family == AF_INET6) | 263 | if (addr.ss_family == AF_INET6) { |
264 | addrlen = sizeof(struct sockaddr_in6); | 264 | addrlen = sizeof(struct sockaddr_in6); |
265 | ipv64_normalise_mapped(&addr, &addrlen); | ||
266 | } | ||
265 | 267 | ||
266 | if (addr.ss_family == AF_UNIX) { | 268 | switch (addr.ss_family) { |
269 | case AF_INET: | ||
270 | case AF_INET6: | ||
271 | /* Get the address in ascii. */ | ||
272 | if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop, | ||
273 | sizeof(ntop), NULL, 0, flags)) != 0) { | ||
274 | error("get_socket_address: getnameinfo %d failed: %s", | ||
275 | flags, ssh_gai_strerror(r)); | ||
276 | return NULL; | ||
277 | } | ||
278 | return xstrdup(ntop); | ||
279 | case AF_UNIX: | ||
267 | /* Get the Unix domain socket path. */ | 280 | /* Get the Unix domain socket path. */ |
268 | return xstrdup(((struct sockaddr_un *)&addr)->sun_path); | 281 | return xstrdup(((struct sockaddr_un *)&addr)->sun_path); |
269 | } | 282 | default: |
270 | 283 | /* We can't look up remote Unix domain sockets. */ | |
271 | ipv64_normalise_mapped(&addr, &addrlen); | ||
272 | |||
273 | /* Get the address in ascii. */ | ||
274 | if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop, | ||
275 | sizeof(ntop), NULL, 0, flags)) != 0) { | ||
276 | error("get_socket_address: getnameinfo %d failed: %s", flags, | ||
277 | ssh_gai_strerror(r)); | ||
278 | return NULL; | 284 | return NULL; |
279 | } | 285 | } |
280 | return xstrdup(ntop); | ||
281 | } | 286 | } |
282 | 287 | ||
283 | char * | 288 | char * |
@@ -390,8 +395,8 @@ get_sock_port(int sock, int local) | |||
390 | if (from.ss_family == AF_INET6) | 395 | if (from.ss_family == AF_INET6) |
391 | fromlen = sizeof(struct sockaddr_in6); | 396 | fromlen = sizeof(struct sockaddr_in6); |
392 | 397 | ||
393 | /* Unix domain sockets don't have a port number. */ | 398 | /* Non-inet sockets don't have a port number. */ |
394 | if (from.ss_family == AF_UNIX) | 399 | if (from.ss_family != AF_INET && from.ss_family != AF_INET6) |
395 | return 0; | 400 | return 0; |
396 | 401 | ||
397 | /* Return port number. */ | 402 | /* Return port number. */ |