View | Details | Raw Unified | Return to bug 1417 | Differences between
and this patch

Collapse All | Expand All

(-)canohost.c (-2 / +10 lines)
Lines 229-235 get_socket_address(int sock, int remote, int flags) Link Here
229
	if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
229
	if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
230
	    sizeof(ntop), NULL, 0, flags)) != 0) {
230
	    sizeof(ntop), NULL, 0, flags)) != 0) {
231
		error("get_socket_address: getnameinfo %d failed: %s", flags,
231
		error("get_socket_address: getnameinfo %d failed: %s", flags,
232
		    r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
232
		    get_gai_strerror(r));
233
		return NULL;
233
		return NULL;
234
	}
234
	}
235
	return xstrdup(ntop);
235
	return xstrdup(ntop);
Lines 325-331 get_sock_port(int sock, int local) Link Here
325
	if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
325
	if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
326
	    strport, sizeof(strport), NI_NUMERICSERV)) != 0)
326
	    strport, sizeof(strport), NI_NUMERICSERV)) != 0)
327
		fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed: %s",
327
		fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed: %s",
328
		    r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
328
		    get_gai_strerror(r));
329
	return atoi(strport);
329
	return atoi(strport);
330
}
330
}
331
331
Lines 367-370 int Link Here
367
get_local_port(void)
367
get_local_port(void)
368
{
368
{
369
	return get_port(1);
369
	return get_port(1);
370
}
371
372
const char *
373
get_gai_strerror(int gaierr)
374
{
375
	if (gaierr == EAI_SYSTEM)
376
		return strerror(errno);
377
	return gai_strerror(gaierr);
370
}
378
}
(-)canohost.h (+1 lines)
Lines 23-25 char *get_local_name(int); Link Here
23
23
24
int		 get_remote_port(void);
24
int		 get_remote_port(void);
25
int		 get_local_port(void);
25
int		 get_local_port(void);
26
const char	*get_gai_strerror(int);
(-)channels.c (-5 / +7 lines)
Lines 2392-2401 channel_setup_fwd_listener(int type, const char *liste Link Here
2392
		if (addr == NULL) {
2392
		if (addr == NULL) {
2393
			/* This really shouldn't happen */
2393
			/* This really shouldn't happen */
2394
			packet_disconnect("getaddrinfo: fatal error: %s",
2394
			packet_disconnect("getaddrinfo: fatal error: %s",
2395
			    gai_strerror(r));
2395
			    get_gai_strerror(r));
2396
		} else {
2396
		} else {
2397
			error("channel_setup_fwd_listener: "
2397
			error("channel_setup_fwd_listener: "
2398
			    "getaddrinfo(%.64s): %s", addr, gai_strerror(r));
2398
			    "getaddrinfo(%.64s): %s", addr,
2399
			    get_gai_strerror(r));
2399
		}
2400
		}
2400
		return 0;
2401
		return 0;
2401
	}
2402
	}
Lines 2709-2715 connect_to(const char *host, u_short port) Link Here
2709
	snprintf(strport, sizeof strport, "%d", port);
2710
	snprintf(strport, sizeof strport, "%d", port);
2710
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
2711
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
2711
		error("connect_to %.100s: unknown host (%s)", host,
2712
		error("connect_to %.100s: unknown host (%s)", host,
2712
		    gai_strerror(gaierr));
2713
		    get_gai_strerror(gaierr));
2713
		return -1;
2714
		return -1;
2714
	}
2715
	}
2715
	for (ai = aitop; ai; ai = ai->ai_next) {
2716
	for (ai = aitop; ai; ai = ai->ai_next) {
Lines 2851-2857 x11_create_display_inet(int x11_display_offset, int x1 Link Here
2851
		hints.ai_socktype = SOCK_STREAM;
2852
		hints.ai_socktype = SOCK_STREAM;
2852
		snprintf(strport, sizeof strport, "%d", port);
2853
		snprintf(strport, sizeof strport, "%d", port);
2853
		if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) {
2854
		if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) {
2854
			error("getaddrinfo: %.100s", gai_strerror(gaierr));
2855
			error("getaddrinfo: %.100s", get_gai_strerror(gaierr));
2855
			return -1;
2856
			return -1;
2856
		}
2857
		}
2857
		for (ai = aitop; ai; ai = ai->ai_next) {
2858
		for (ai = aitop; ai; ai = ai->ai_next) {
Lines 3002-3008 x11_connect_display(void) Link Here
3002
	hints.ai_socktype = SOCK_STREAM;
3003
	hints.ai_socktype = SOCK_STREAM;
3003
	snprintf(strport, sizeof strport, "%u", 6000 + display_number);
3004
	snprintf(strport, sizeof strport, "%u", 6000 + display_number);
3004
	if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) {
3005
	if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) {
3005
		error("%.100s: unknown host. (%s)", buf, gai_strerror(gaierr));
3006
		error("%.100s: unknown host. (%s)", buf,
3007
		get_gai_strerror(gaierr));
3006
		return -1;
3008
		return -1;
3007
	}
3009
	}
3008
	for (ai = aitop; ai; ai = ai->ai_next) {
3010
	for (ai = aitop; ai; ai = ai->ai_next) {
(-)servconf.c (-1 / +1 lines)
Lines 421-427 add_one_listen_addr(ServerOptions *options, char *addr Link Here
421
	if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
421
	if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
422
		fatal("bad addr or host: %s (%s)",
422
		fatal("bad addr or host: %s (%s)",
423
		    addr ? addr : "<NULL>",
423
		    addr ? addr : "<NULL>",
424
		    gai_strerror(gaierr));
424
		    get_gai_strerror(gaierr));
425
	for (ai = aitop; ai->ai_next; ai = ai->ai_next)
425
	for (ai = aitop; ai->ai_next; ai = ai->ai_next)
426
		;
426
		;
427
	ai->ai_next = options->listen_addrs;
427
	ai->ai_next = options->listen_addrs;
(-)ssh-keyscan.c (-1 / +1 lines)
Lines 395-401 tcpconnect(char *host) Link Here
395
	hints.ai_family = IPv4or6;
395
	hints.ai_family = IPv4or6;
396
	hints.ai_socktype = SOCK_STREAM;
396
	hints.ai_socktype = SOCK_STREAM;
397
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
397
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
398
		fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr));
398
		fatal("getaddrinfo %s: %s", host, get_gai_strerror(gaierr));
399
	for (ai = aitop; ai; ai = ai->ai_next) {
399
	for (ai = aitop; ai; ai = ai->ai_next) {
400
		s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
400
		s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
401
		if (s < 0) {
401
		if (s < 0) {
(-)sshconnect.c (-2 / +2 lines)
Lines 211-217 ssh_create_socket(int privileged, struct addrinfo *ai) Link Here
211
	gaierr = getaddrinfo(options.bind_address, "0", &hints, &res);
211
	gaierr = getaddrinfo(options.bind_address, "0", &hints, &res);
212
	if (gaierr) {
212
	if (gaierr) {
213
		error("getaddrinfo: %s: %s", options.bind_address,
213
		error("getaddrinfo: %s: %s", options.bind_address,
214
		    gai_strerror(gaierr));
214
		    get_gai_strerror(gaierr));
215
		close(sock);
215
		close(sock);
216
		return -1;
216
		return -1;
217
	}
217
	}
Lines 344-350 ssh_connect(const char *host, struct sockaddr_storage Link Here
344
	snprintf(strport, sizeof strport, "%u", port);
344
	snprintf(strport, sizeof strport, "%u", port);
345
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
345
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
346
		fatal("%s: %.100s: %s", __progname, host,
346
		fatal("%s: %.100s: %s", __progname, host,
347
		    gai_strerror(gaierr));
347
		    get_gai_strerror(gaierr));
348
348
349
	for (attempt = 0; attempt < connection_attempts; attempt++) {
349
	for (attempt = 0; attempt < connection_attempts; attempt++) {
350
		if (attempt > 0) {
350
		if (attempt > 0) {
(-)sshd.c (-2 / +1 lines)
Lines 928-935 server_listen(void) Link Here
928
		    ntop, sizeof(ntop), strport, sizeof(strport),
928
		    ntop, sizeof(ntop), strport, sizeof(strport),
929
		    NI_NUMERICHOST|NI_NUMERICSERV)) != 0) {
929
		    NI_NUMERICHOST|NI_NUMERICSERV)) != 0) {
930
			error("getnameinfo failed: %.100s",
930
			error("getnameinfo failed: %.100s",
931
			    (ret != EAI_SYSTEM) ? gai_strerror(ret) :
931
			    get_gai_strerror(ret));
932
			    strerror(errno));
933
			continue;
932
			continue;
934
		}
933
		}
935
		/* Create socket for listening. */
934
		/* Create socket for listening. */

Return to bug 1417