summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/canohost.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-10-29 09:43:00 +0000
committerdes <des@FreeBSD.org>2002-10-29 09:43:00 +0000
commit099d1a58f7bc088a9f71af6d32542ca3949468a3 (patch)
tree49cef8938d7beb10016662d15546fa090865073d /crypto/openssh/canohost.c
parent1ba793a7c09e24d920de3983a3223770cb37ebff (diff)
downloadFreeBSD-src-099d1a58f7bc088a9f71af6d32542ca3949468a3.zip
FreeBSD-src-099d1a58f7bc088a9f71af6d32542ca3949468a3.tar.gz
Vendor import of OpenSSH-portable 3.5p1.
Diffstat (limited to 'crypto/openssh/canohost.c')
-rw-r--r--crypto/openssh/canohost.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/crypto/openssh/canohost.c b/crypto/openssh/canohost.c
index 00c499c..a457d3c 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 *
OpenPOWER on IntegriCloud