diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-10-29 09:43:00 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-10-29 09:43:00 +0000 |
commit | 4b17dab0ba7675679933f9f3d4aed1cd28dd0393 (patch) | |
tree | 49cef8938d7beb10016662d15546fa090865073d /crypto/openssh/canohost.c | |
parent | ee21a45f81a0d84007f4e9b4175b9eb4727a96ee (diff) | |
download | src-test2-4b17dab0ba7675679933f9f3d4aed1cd28dd0393.tar.gz src-test2-4b17dab0ba7675679933f9f3d4aed1cd28dd0393.zip |
Notes
Diffstat (limited to 'crypto/openssh/canohost.c')
-rw-r--r-- | crypto/openssh/canohost.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/crypto/openssh/canohost.c b/crypto/openssh/canohost.c index 00c499ca041f..a457d3c52243 100644 --- a/crypto/openssh/canohost.c +++ b/crypto/openssh/canohost.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: canohost.c,v 1.32 2002/06/11 08:11:45 itojun Exp $"); +RCSID("$OpenBSD: canohost.c,v 1.34 2002/09/23 20:46:27 stevesk Exp $"); #include "packet.h" #include "xmalloc.h" @@ -77,7 +77,9 @@ get_remote_hostname(int socket, int verify_reverse_mapping) if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), NULL, 0, NI_NAMEREQD) != 0) { /* Host name not found. Use ip address. */ +#if 0 log("Could not reverse map address %.100s.", ntop); +#endif return xstrdup(ntop); } @@ -216,18 +218,12 @@ get_socket_address(int socket, int remote, int flags) if (remote) { if (getpeername(socket, (struct sockaddr *)&addr, &addrlen) - < 0) { - debug("get_socket_ipaddr: getpeername failed: %.100s", - strerror(errno)); + < 0) return NULL; - } } else { if (getsockname(socket, (struct sockaddr *)&addr, &addrlen) - < 0) { - debug("get_socket_ipaddr: getsockname failed: %.100s", - strerror(errno)); + < 0) return NULL; - } } /* Get the address in ascii. */ if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), @@ -241,13 +237,21 @@ get_socket_address(int socket, int remote, int flags) char * get_peer_ipaddr(int socket) { - return get_socket_address(socket, 1, NI_NUMERICHOST); + char *p; + + if ((p = get_socket_address(socket, 1, NI_NUMERICHOST)) != NULL) + return p; + return xstrdup("UNKNOWN"); } char * get_local_ipaddr(int socket) { - return get_socket_address(socket, 0, NI_NUMERICHOST); + char *p; + + if ((p = get_socket_address(socket, 0, NI_NUMERICHOST)) != NULL) + return p; + return xstrdup("UNKNOWN"); } char * |