From e982773d2aa4f5fdc5e9f42838fc3d06c1f12d0b Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Thu, 11 Jul 2002 03:56:46 +0000 Subject: - itojun@cvs.openbsd.org 2002/07/09 11:56:27 [canohost.c] suppress log on reverse lookup failiure, as there's no real value in doing so. markus ok --- canohost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'canohost.c') diff --git a/canohost.c b/canohost.c index 00c499ca0..8081ed598 100644 --- a/canohost.c +++ b/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.33 2002/07/09 11:56:27 itojun 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); } -- cgit v1.2.3 From b2f844dc513d31de09ae696092497856a2968d26 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 25 Sep 2002 12:19:08 +1000 Subject: - (djm) OpenBSD CVS Sync - stevesk@cvs.openbsd.org 2002/09/23 20:46:27 [canohost.c] change get_peer_ipaddr() and get_local_ipaddr() to not return NULL for non-sockets; fixes a problem passing NULL to snprintf(). ok markus@ --- ChangeLog | 9 ++++++++- canohost.c | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'canohost.c') diff --git a/ChangeLog b/ChangeLog index 1f9ef0251..c31b577d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20020923 + - (djm) OpenBSD CVS Sync + - stevesk@cvs.openbsd.org 2002/09/23 20:46:27 + [canohost.c] + change get_peer_ipaddr() and get_local_ipaddr() to not return NULL for + non-sockets; fixes a problem passing NULL to snprintf(). ok markus@ + 20020923 - (tim) [configure.ac] s/return/exit/ patch by dtucker@zip.com.au @@ -696,4 +703,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2476 2002/09/23 23:54:10 tim Exp $ +$Id: ChangeLog,v 1.2477 2002/09/25 02:19:08 djm Exp $ diff --git a/canohost.c b/canohost.c index 8081ed598..a457d3c52 100644 --- a/canohost.c +++ b/canohost.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: canohost.c,v 1.33 2002/07/09 11:56:27 itojun Exp $"); +RCSID("$OpenBSD: canohost.c,v 1.34 2002/09/23 20:46:27 stevesk Exp $"); #include "packet.h" #include "xmalloc.h" @@ -218,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), @@ -243,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 * -- cgit v1.2.3