diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | canohost.c | 18 |
2 files changed, 15 insertions, 8 deletions
@@ -3,6 +3,9 @@ | |||
3 | - otto@cvs.openbsd.org 2005/02/16 09:56:44 | 3 | - otto@cvs.openbsd.org 2005/02/16 09:56:44 |
4 | [ssh.c] | 4 | [ssh.c] |
5 | Better diagnostic if an identity file is not accesible. ok markus@ djm@ | 5 | Better diagnostic if an identity file is not accesible. ok markus@ djm@ |
6 | - djm@cvs.openbsd.org 2005/02/18 03:05:53 | ||
7 | [canohost.c] | ||
8 | better error messages for getnameinfo failures; ok dtucker@ | ||
6 | 9 | ||
7 | 20050226 | 10 | 20050226 |
8 | - (dtucker) [openbsd-compat/bsd-openpty.c openbsd-compat/inet_ntop.c] | 11 | - (dtucker) [openbsd-compat/bsd-openpty.c openbsd-compat/inet_ntop.c] |
@@ -2179,4 +2182,4 @@ | |||
2179 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 2182 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
2180 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 2183 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
2181 | 2184 | ||
2182 | $Id: ChangeLog,v 1.3667 2005/03/01 10:15:46 djm Exp $ | 2185 | $Id: ChangeLog,v 1.3668 2005/03/01 10:16:18 djm Exp $ |
diff --git a/canohost.c b/canohost.c index e5a6b6be3..1c22d4770 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $"); | 15 | RCSID("$OpenBSD: canohost.c,v 1.42 2005/02/18 03:05:53 djm Exp $"); |
16 | 16 | ||
17 | #include "packet.h" | 17 | #include "packet.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -231,6 +231,7 @@ get_socket_address(int sock, int remote, int flags) | |||
231 | struct sockaddr_storage addr; | 231 | struct sockaddr_storage addr; |
232 | socklen_t addrlen; | 232 | socklen_t addrlen; |
233 | char ntop[NI_MAXHOST]; | 233 | char ntop[NI_MAXHOST]; |
234 | int r; | ||
234 | 235 | ||
235 | /* Get IP address of client. */ | 236 | /* Get IP address of client. */ |
236 | addrlen = sizeof(addr); | 237 | addrlen = sizeof(addr); |
@@ -251,9 +252,10 @@ get_socket_address(int sock, int remote, int flags) | |||
251 | addrlen = sizeof(struct sockaddr_in6); | 252 | addrlen = sizeof(struct sockaddr_in6); |
252 | 253 | ||
253 | /* Get the address in ascii. */ | 254 | /* Get the address in ascii. */ |
254 | if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), | 255 | if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop, |
255 | NULL, 0, flags) != 0) { | 256 | sizeof(ntop), NULL, 0, flags)) != 0) { |
256 | error("get_socket_address: getnameinfo %d failed", flags); | 257 | error("get_socket_address: getnameinfo %d failed: %s", flags, |
258 | r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r)); | ||
257 | return NULL; | 259 | return NULL; |
258 | } | 260 | } |
259 | return xstrdup(ntop); | 261 | return xstrdup(ntop); |
@@ -329,6 +331,7 @@ get_sock_port(int sock, int local) | |||
329 | struct sockaddr_storage from; | 331 | struct sockaddr_storage from; |
330 | socklen_t fromlen; | 332 | socklen_t fromlen; |
331 | char strport[NI_MAXSERV]; | 333 | char strport[NI_MAXSERV]; |
334 | int r; | ||
332 | 335 | ||
333 | /* Get IP address of client. */ | 336 | /* Get IP address of client. */ |
334 | fromlen = sizeof(from); | 337 | fromlen = sizeof(from); |
@@ -350,9 +353,10 @@ get_sock_port(int sock, int local) | |||
350 | fromlen = sizeof(struct sockaddr_in6); | 353 | fromlen = sizeof(struct sockaddr_in6); |
351 | 354 | ||
352 | /* Return port number. */ | 355 | /* Return port number. */ |
353 | if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, | 356 | if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, |
354 | strport, sizeof(strport), NI_NUMERICSERV) != 0) | 357 | strport, sizeof(strport), NI_NUMERICSERV)) != 0) |
355 | fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed"); | 358 | fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed: %s", |
359 | r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r)); | ||
356 | return atoi(strport); | 360 | return atoi(strport); |
357 | } | 361 | } |
358 | 362 | ||