From 18a32a7efa9ca967bf1ca2b55a6543c180aceaeb Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Tue, 11 Jun 2002 15:46:34 +0000 Subject: [PATCH] - itojun@cvs.openbsd.org 2002/06/09 22:17:21 [sshconnect.c] pass salen to sockaddr_ntop so that we are happy on linux/solaris --- ChangeLog | 5 ++++- sshconnect.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34a863b1b..c2c13aa10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ - stevesk@cvs.openbsd.org 2002/06/09 22:15:15 [ssh.1] update for no setuid root and ssh-keysign; ok deraadt@ + - itojun@cvs.openbsd.org 2002/06/09 22:17:21 + [sshconnect.c] + pass salen to sockaddr_ntop so that we are happy on linux/solaris 20020609 - (bal) OpenBSD CVS Sync @@ -869,4 +872,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2200 2002/06/11 15:45:02 mouring Exp $ +$Id: ChangeLog,v 1.2201 2002/06/11 15:46:34 mouring Exp $ diff --git a/sshconnect.c b/sshconnect.c index 369b31dfe..651e3fcf4 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.122 2002/06/09 04:33:27 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.123 2002/06/09 22:17:21 itojun Exp $"); #include @@ -44,11 +44,11 @@ extern char *__progname; #endif static const char * -sockaddr_ntop(struct sockaddr *sa) +sockaddr_ntop(struct sockaddr *sa, socklen_t salen) { static char addrbuf[NI_MAXHOST]; - if (getnameinfo(sa, sa->sa_len, addrbuf, sizeof(addrbuf), NULL, 0, + if (getnameinfo(sa, salen, addrbuf, sizeof(addrbuf), NULL, 0, NI_NUMERICHOST) != 0) fatal("sockaddr_ntop: getnameinfo NI_NUMERICHOST failed"); return addrbuf; @@ -322,8 +322,8 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, if (errno == ECONNREFUSED) full_failure = 0; log("ssh: connect to address %s port %s: %s", - sockaddr_ntop(ai->ai_addr), strport, - strerror(errno)); + sockaddr_ntop(ai->ai_addr, ai->ai_addrlen), + strport, strerror(errno)); restore_uid(); /* * Close the failed socket; there appear to