summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-09 20:14:54 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-09 20:14:54 +0000
commit159ac2e8cd9fb69c21916bdf5f742eccbb4f2695 (patch)
tree1d9c69326273090da0bb1db1407740b13cb2268f /sshconnect.c
parent2e17b08e482024de21aaf7d4517e1594e7fb7a62 (diff)
- itojun@cvs.openbsd.org 2002/06/08 21:15:27
[sshconnect.c] always use getnameinfo. (diag message only)
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 7af0b9a8..9444e3cf 100644
--- a/sshconnect.c
+++ b/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>
@@ -46,21 +46,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;
}