Code question (canohost.c)

YOSHIFUJI Hideaki / 吉藤英明 yoshfuji at linux-ipv6.org
Fri Apr 30 12:32:51 EST 2004


In article <Pine.BSO.4.44.0404292120270.953-100000 at etoh.eviladmin.org> (at Thu, 29 Apr 2004 21:24:36 -0500 (CDT)), Ben Lindstrom <mouring at etoh.eviladmin.org> says:

> > since options.bind_address may be NULL.
> > (Note: host and/or port must non-NULL.)
:
>  Tell me how options.bind_address can reach getaddrinfo() as null. As I
> see it there is no possible way it can happen.

(Mails are crossing..)
Correct. I was wrong. Sorry.

--- openssh-3.8.1p1/sshconnect.c	Tue Jan 27 19:21:27 2004
+++ openssh-3.8.1p1-fix/sshconnect.c	Fri Apr 30 11:24:48 2004
@@ -202,7 +202,7 @@
 	hints.ai_socktype = ai->ai_socktype;
 	hints.ai_protocol = ai->ai_protocol;
 	hints.ai_flags = AI_PASSIVE;
-	gaierr = getaddrinfo(options.bind_address, "0", &hints, &res);
+	gaierr = getaddrinfo(options.bind_address, NULL, &hints, &res);
 	if (gaierr) {
 		error("getaddrinfo: %s: %s", options.bind_address,
 		    gai_strerror(gaierr));
--- openssh-3.8.1p1/canohost.c	Wed Mar 31 14:17:54 2004
+++ openssh-3.8.1p1-fix/canohost.c	Fri Apr 30 11:25:03 2004
@@ -75,7 +75,7 @@
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_socktype = SOCK_DGRAM;	/*dummy*/
 	hints.ai_flags = AI_NUMERICHOST;
-	if (getaddrinfo(name, "0", &hints, &ai) == 0) {
+	if (getaddrinfo(name, NULL, &hints, &ai) == 0) {
 		logit("Nasty PTR record \"%s\" is set up for %s, ignoring",
 		    name, ntop);
 		freeaddrinfo(ai);

--yoshfuji




More information about the openssh-unix-dev mailing list