diff options
author | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
commit | 487bdb3a5ef6075887b830ccb8a0b14f6da78e93 (patch) | |
tree | a2cff6fec1e6c4b4153a170a3e172cfe6bfdec46 /canohost.c | |
parent | 796ba4fd011b5d0d9d78d592ba2f30fc9d5ed2e7 (diff) | |
parent | 28453d58058a4d60c3ebe7d7f0c31a510cbf6158 (diff) |
Import openssh_6.7p1.orig.tar.gz
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/canohost.c b/canohost.c index a61a8c94d..a3e3bbff8 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: canohost.c,v 1.70 2014/01/19 04:17:29 dtucker Exp $ */ | 1 | /* $OpenBSD: canohost.c,v 1.71 2014/07/15 15:54:14 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 |
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <sys/types.h> | 17 | #include <sys/types.h> |
18 | #include <sys/socket.h> | 18 | #include <sys/socket.h> |
19 | #include <sys/un.h> | ||
19 | 20 | ||
20 | #include <netinet/in.h> | 21 | #include <netinet/in.h> |
21 | #include <arpa/inet.h> | 22 | #include <arpa/inet.h> |
@@ -262,6 +263,11 @@ get_socket_address(int sock, int remote, int flags) | |||
262 | if (addr.ss_family == AF_INET6) | 263 | if (addr.ss_family == AF_INET6) |
263 | addrlen = sizeof(struct sockaddr_in6); | 264 | addrlen = sizeof(struct sockaddr_in6); |
264 | 265 | ||
266 | if (addr.ss_family == AF_UNIX) { | ||
267 | /* Get the Unix domain socket path. */ | ||
268 | return xstrdup(((struct sockaddr_un *)&addr)->sun_path); | ||
269 | } | ||
270 | |||
265 | ipv64_normalise_mapped(&addr, &addrlen); | 271 | ipv64_normalise_mapped(&addr, &addrlen); |
266 | 272 | ||
267 | /* Get the address in ascii. */ | 273 | /* Get the address in ascii. */ |
@@ -384,6 +390,10 @@ get_sock_port(int sock, int local) | |||
384 | if (from.ss_family == AF_INET6) | 390 | if (from.ss_family == AF_INET6) |
385 | fromlen = sizeof(struct sockaddr_in6); | 391 | fromlen = sizeof(struct sockaddr_in6); |
386 | 392 | ||
393 | /* Unix domain sockets don't have a port number. */ | ||
394 | if (from.ss_family == AF_UNIX) | ||
395 | return 0; | ||
396 | |||
387 | /* Return port number. */ | 397 | /* Return port number. */ |
388 | if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, | 398 | if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, |
389 | strport, sizeof(strport), NI_NUMERICSERV)) != 0) | 399 | strport, sizeof(strport), NI_NUMERICSERV)) != 0) |