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

Collapse All | Expand All

(-)a/canohost.c (+4 lines)
Lines 113-118 Link Here
113
	memset(&hints, 0, sizeof(hints));
113
	memset(&hints, 0, sizeof(hints));
114
	hints.ai_family = from.ss_family;
114
	hints.ai_family = from.ss_family;
115
	hints.ai_socktype = SOCK_STREAM;
115
	hints.ai_socktype = SOCK_STREAM;
116
#ifdef AI_ADDRCONFIG
117
	if (hints.ai_family == AF_UNSPEC)
118
		hints.ai_flags = AI_ADDRCONFIG;
119
#endif /* AI_ADDRCONFIG */
116
	if (getaddrinfo(name, NULL, &hints, &aitop) != 0) {
120
	if (getaddrinfo(name, NULL, &hints, &aitop) != 0) {
117
		logit("reverse mapping checking getaddrinfo for %.700s "
121
		logit("reverse mapping checking getaddrinfo for %.700s "
118
		    "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop);
122
		    "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop);
(-)a/channels.c (-2 / +18 lines)
Lines 2853-2860 Link Here
2853
	 */
2853
	 */
2854
	memset(&hints, 0, sizeof(hints));
2854
	memset(&hints, 0, sizeof(hints));
2855
	hints.ai_family = IPv4or6;
2855
	hints.ai_family = IPv4or6;
2856
	hints.ai_flags = wildcard ? AI_PASSIVE : 0;
2857
	hints.ai_socktype = SOCK_STREAM;
2856
	hints.ai_socktype = SOCK_STREAM;
2857
	hints.ai_flags = wildcard ? AI_PASSIVE : 0;
2858
#ifdef AI_ADDRCONFIG
2859
	if (hints.ai_family == AF_UNSPEC)
2860
		hints.ai_flags |= AI_ADDRCONFIG;
2861
#endif /* AI_ADDRCONFIG */
2858
	snprintf(strport, sizeof strport, "%d", fwd->listen_port);
2862
	snprintf(strport, sizeof strport, "%d", fwd->listen_port);
2859
	if ((r = getaddrinfo(addr, strport, &hints, &aitop)) != 0) {
2863
	if ((r = getaddrinfo(addr, strport, &hints, &aitop)) != 0) {
2860
		if (addr == NULL) {
2864
		if (addr == NULL) {
Lines 3736-3741 Link Here
3736
		memset(&hints, 0, sizeof(hints));
3740
		memset(&hints, 0, sizeof(hints));
3737
		hints.ai_family = IPv4or6;
3741
		hints.ai_family = IPv4or6;
3738
		hints.ai_socktype = SOCK_STREAM;
3742
		hints.ai_socktype = SOCK_STREAM;
3743
#ifdef AI_ADDRCONFIG
3744
		if (hints.ai_family == AF_UNSPEC)
3745
			hints.ai_flags = AI_ADDRCONFIG;
3746
#endif /* AI_ADDRCONFIG */
3739
		snprintf(strport, sizeof strport, "%d", port);
3747
		snprintf(strport, sizeof strport, "%d", port);
3740
		if ((gaierr = getaddrinfo(name, strport, &hints, &cctx.aitop)) != 0) {
3748
		if ((gaierr = getaddrinfo(name, strport, &hints, &cctx.aitop)) != 0) {
3741
			error("connect_to %.100s: unknown host (%s)", name,
3749
			error("connect_to %.100s: unknown host (%s)", name,
Lines 3908-3915 Link Here
3908
		port = 6000 + display_number;
3916
		port = 6000 + display_number;
3909
		memset(&hints, 0, sizeof(hints));
3917
		memset(&hints, 0, sizeof(hints));
3910
		hints.ai_family = IPv4or6;
3918
		hints.ai_family = IPv4or6;
3911
		hints.ai_flags = x11_use_localhost ? 0: AI_PASSIVE;
3912
		hints.ai_socktype = SOCK_STREAM;
3919
		hints.ai_socktype = SOCK_STREAM;
3920
		hints.ai_flags = x11_use_localhost ? 0: AI_PASSIVE;
3921
#ifdef AI_ADDRCONFIG
3922
		if (hints.ai_family == AF_UNSPEC)
3923
			hints.ai_flags |= AI_ADDRCONFIG;
3924
#endif /* AI_ADDRCONFIG */
3913
		snprintf(strport, sizeof strport, "%d", port);
3925
		snprintf(strport, sizeof strport, "%d", port);
3914
		if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) {
3926
		if ((gaierr = getaddrinfo(NULL, strport, &hints, &aitop)) != 0) {
3915
			error("getaddrinfo: %.100s", ssh_gai_strerror(gaierr));
3927
			error("getaddrinfo: %.100s", ssh_gai_strerror(gaierr));
Lines 4090-4095 Link Here
4090
	memset(&hints, 0, sizeof(hints));
4102
	memset(&hints, 0, sizeof(hints));
4091
	hints.ai_family = IPv4or6;
4103
	hints.ai_family = IPv4or6;
4092
	hints.ai_socktype = SOCK_STREAM;
4104
	hints.ai_socktype = SOCK_STREAM;
4105
#ifdef AI_ADDRCONFIG
4106
	if (hints.ai_family == AF_UNSPEC)
4107
		hints.ai_flags = AI_ADDRCONFIG;
4108
#endif /* AI_ADDRCONFIG */
4093
	snprintf(strport, sizeof strport, "%u", 6000 + display_number);
4109
	snprintf(strport, sizeof strport, "%u", 6000 + display_number);
4094
	if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) {
4110
	if ((gaierr = getaddrinfo(buf, strport, &hints, &aitop)) != 0) {
4095
		error("%.100s: unknown host. (%s)", buf,
4111
		error("%.100s: unknown host. (%s)", buf,
(-)a/servconf.c (+4 lines)
Lines 722-727 Link Here
722
	hints.ai_family = options->address_family;
722
	hints.ai_family = options->address_family;
723
	hints.ai_socktype = SOCK_STREAM;
723
	hints.ai_socktype = SOCK_STREAM;
724
	hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
724
	hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
725
#ifdef AI_ADDRCONFIG
726
	if (hints.ai_family == AF_UNSPEC)
727
		hints.ai_flags |= AI_ADDRCONFIG;
728
#endif /* AI_ADDRCONFIG */
725
	snprintf(strport, sizeof strport, "%d", port);
729
	snprintf(strport, sizeof strport, "%d", port);
726
	if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
730
	if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
727
		fatal("bad addr or host: %s (%s)",
731
		fatal("bad addr or host: %s (%s)",
(-)a/ssh-keyscan.c (+4 lines)
Lines 326-331 Link Here
326
	memset(&hints, 0, sizeof(hints));
326
	memset(&hints, 0, sizeof(hints));
327
	hints.ai_family = IPv4or6;
327
	hints.ai_family = IPv4or6;
328
	hints.ai_socktype = SOCK_STREAM;
328
	hints.ai_socktype = SOCK_STREAM;
329
#ifdef AI_ADDRCONFIG
330
	if (hints.ai_family == AF_UNSPEC)
331
		hints.ai_flags = AI_ADDRCONFIG;
332
#endif /* AI_ADDRCONFIG */
329
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
333
	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
330
		error("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
334
		error("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
331
		return -1;
335
		return -1;
(-)a/ssh.c (+8 lines)
Lines 259-264 Link Here
259
	hints.ai_socktype = SOCK_STREAM;
259
	hints.ai_socktype = SOCK_STREAM;
260
	if (cname != NULL)
260
	if (cname != NULL)
261
		hints.ai_flags = AI_CANONNAME;
261
		hints.ai_flags = AI_CANONNAME;
262
#ifdef AI_ADDRCONFIG
263
	if (hints.ai_family == AF_UNSPEC)
264
		hints.ai_flags |= AI_ADDRCONFIG;
265
#endif /* AI_ADDRCONFIG */
262
	if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
266
	if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
263
		if (logerr || (gaierr != EAI_NONAME && gaierr != EAI_NODATA))
267
		if (logerr || (gaierr != EAI_NONAME && gaierr != EAI_NODATA))
264
			loglevel = SYSLOG_LEVEL_ERROR;
268
			loglevel = SYSLOG_LEVEL_ERROR;
Lines 298-303 Link Here
298
	    AF_UNSPEC : options.address_family;
302
	    AF_UNSPEC : options.address_family;
299
	hints.ai_socktype = SOCK_STREAM;
303
	hints.ai_socktype = SOCK_STREAM;
300
	hints.ai_flags = AI_NUMERICHOST|AI_NUMERICSERV;
304
	hints.ai_flags = AI_NUMERICHOST|AI_NUMERICSERV;
305
#ifdef AI_ADDRCONFIG
306
	if (hints.ai_family == AF_UNSPEC)
307
		hints.ai_flags |= AI_ADDRCONFIG;
308
#endif /* AI_ADDRCONFIG */
301
	if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
309
	if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
302
		debug2("%s: could not resolve name %.100s as address: %s",
310
		debug2("%s: could not resolve name %.100s as address: %s",
303
		    __func__, name, ssh_gai_strerror(gaierr));
311
		    __func__, name, ssh_gai_strerror(gaierr));
(-)a/sshconnect.c (+4 lines)
Lines 292-297 Link Here
292
		hints.ai_socktype = ai->ai_socktype;
292
		hints.ai_socktype = ai->ai_socktype;
293
		hints.ai_protocol = ai->ai_protocol;
293
		hints.ai_protocol = ai->ai_protocol;
294
		hints.ai_flags = AI_PASSIVE;
294
		hints.ai_flags = AI_PASSIVE;
295
#ifdef AI_ADDRCONFIG
296
		if (hints.ai_family == AF_UNSPEC)
297
			hints.ai_flags |= AI_ADDRCONFIG;
298
#endif /* AI_ADDRCONFIG */
295
		gaierr = getaddrinfo(options.bind_address, NULL, &hints, &res);
299
		gaierr = getaddrinfo(options.bind_address, NULL, &hints, &res);
296
		if (gaierr) {
300
		if (gaierr) {
297
			error("getaddrinfo: %s: %s", options.bind_address,
301
			error("getaddrinfo: %s: %s", options.bind_address,
(-)a/regress/netcat.c (-1 / +17 lines)
Lines 371-376 Link Here
371
		hints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
371
		hints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
372
		if (nflag)
372
		if (nflag)
373
			hints.ai_flags |= AI_NUMERICHOST;
373
			hints.ai_flags |= AI_NUMERICHOST;
374
#ifdef AI_ADDRCONFIG
375
		if (hints.ai_family == AF_UNSPEC)
376
			hints.ai_flags |= AI_ADDRCONFIG;
377
#endif /* AI_ADDRCONFIG */
374
	}
378
	}
375
379
376
	if (xflag) {
380
	if (xflag) {
Lines 399-404 Link Here
399
		proxyhints.ai_protocol = IPPROTO_TCP;
403
		proxyhints.ai_protocol = IPPROTO_TCP;
400
		if (nflag)
404
		if (nflag)
401
			proxyhints.ai_flags |= AI_NUMERICHOST;
405
			proxyhints.ai_flags |= AI_NUMERICHOST;
406
#ifdef AI_ADDRCONFIG
407
		if (proxyhints.ai_family == AF_UNSPEC)
408
			proxyhints.ai_flags |= AI_ADDRCONFIG;
409
#endif /* AI_ADDRCONFIG */
402
	}
410
	}
403
411
404
	if (lflag) {
412
	if (lflag) {
Lines 673-678 Link Here
673
			ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
681
			ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
674
			ahints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
682
			ahints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
675
			ahints.ai_flags = AI_PASSIVE;
683
			ahints.ai_flags = AI_PASSIVE;
684
#ifdef AI_ADDRCONFIG
685
			if (ahints.ai_family == AF_UNSPEC)
686
				ahints.ai_flags |= AI_ADDRCONFIG;
687
#endif /* AI_ADDRCONFIG */
676
			if ((error = getaddrinfo(sflag, pflag, &ahints, &ares)))
688
			if ((error = getaddrinfo(sflag, pflag, &ahints, &ares)))
677
				errx(1, "getaddrinfo: %s", gai_strerror(error));
689
				errx(1, "getaddrinfo: %s", gai_strerror(error));
678
690
Lines 1422-1429 Link Here
1422
1434
1423
	bzero(&hints, sizeof(hints));
1435
	bzero(&hints, sizeof(hints));
1424
	hints.ai_family = v4only ? PF_INET : PF_UNSPEC;
1436
	hints.ai_family = v4only ? PF_INET : PF_UNSPEC;
1425
	hints.ai_flags = numeric ? AI_NUMERICHOST : 0;
1426
	hints.ai_socktype = SOCK_STREAM;
1437
	hints.ai_socktype = SOCK_STREAM;
1438
	hints.ai_flags = numeric ? AI_NUMERICHOST : 0;
1439
#ifdef AI_ADDRCONFIG
1440
	if (hints.ai_family == AF_UNSPEC)
1441
		hints.ai_flags |= AI_ADDRCONFIG;
1442
#endif /* AI_ADDRCONFIG */
1427
	r = getaddrinfo(h, p, &hints, &res);
1443
	r = getaddrinfo(h, p, &hints, &res);
1428
	/* Don't fatal when attempting to convert a numeric address */
1444
	/* Don't fatal when attempting to convert a numeric address */
1429
	if (r != 0) {
1445
	if (r != 0) {

Return to bug 2483