summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-08 21:15:28 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-08 21:15:28 +0000
commitabd19699de943db357726b3c456f8bed82702459 (patch)
treed6c98237249b7fcdbf258c8172113ab49d3769d1 /usr.bin
parent47335f60b8931de610eb88cb28eab399b1510f8c (diff)
always use getnameinfo. (diag message only)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sshconnect.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c
index a41a84abd62..da49ee0b410 100644
--- a/usr.bin/ssh/sshconnect.c
+++ b/usr.bin/ssh/sshconnect.c
@@ -13,7 +13,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.120 2002/05/23 19:24:30 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.121 2002/06/08 21:15:27 itojun Exp $");
#include <openssl/bn.h>
@@ -42,21 +42,11 @@ extern char *__progname;
static const char *
sockaddr_ntop(struct sockaddr *sa)
{
- void *addr;
- static char addrbuf[INET6_ADDRSTRLEN];
+ static char addrbuf[NI_MAXHOST];
- switch (sa->sa_family) {
- case AF_INET:
- addr = &((struct sockaddr_in *)sa)->sin_addr;
- break;
- case AF_INET6:
- addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
- break;
- default:
- /* This case should be protected against elsewhere */
+ if (getnameinfo(sa, sa->sa_len, addrbuf, sizeof(addrbuf), NULL, 0,
+ NI_NUMERICHOST) != 0)
abort(); /* XXX abort is bad -- do something else */
- }
- inet_ntop(sa->sa_family, addr, addrbuf, sizeof(addrbuf));
return addrbuf;
}