Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/crypto/dist/ssh Pull up revision 1.17 (requested by ito...



details:   https://anonhg.NetBSD.org/src/rev/53695b62bd53
branches:  netbsd-1-6
changeset: 527857:53695b62bd53
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Jun 10 18:05:04 2002 +0000

description:
Pull up revision 1.17 (requested by itojun in ticket #216):
use getnameinfo on diag printing.

diffstat:

 crypto/dist/ssh/sshconnect.c |  18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diffs (34 lines):

diff -r 41e8c94632cf -r 53695b62bd53 crypto/dist/ssh/sshconnect.c
--- a/crypto/dist/ssh/sshconnect.c      Mon Jun 10 18:04:04 2002 +0000
+++ b/crypto/dist/ssh/sshconnect.c      Mon Jun 10 18:05:04 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sshconnect.c,v 1.16 2002/03/08 02:00:56 itojun Exp $   */
+/*     $NetBSD: sshconnect.c,v 1.16.2.1 2002/06/10 18:05:04 tv Exp $   */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -43,21 +43,11 @@
 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;
 }
 



Home | Main Index | Thread Index | Old Index