fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]6.0.0 release is imminent

2002-06-18 09:57:11
"Michael H. Warfield" <mhw(_at_)wittsend(_dot_)com> writes:

      Looking through the OpenSSH portable code, it looks as though
we need to use the "getaddrinfo" call instead of the "gethostbyname"
call in order to properly support IPv6.  At least that's what they've
done.  I don't know if there are any platforms on which this would
be a problem, but OpenSSH doesn't have any conditional compiles wrap
around that call AFAICT.  The change is non-trivial, however.  The
returned structures are quite different.  I'm looking at it now.

Different, yes, but getaddrinfo covers it all, and you're getting the
service lookup for free. (My other mail that pointed this out has been
sent with a "wrong" from address and awaits moderation.)

      Interesting enough, SockOpen() USES getaddrinfo if INET6_ENABLE
is defined.  That explains why IPv6 works for connecting to an IPv6
host which has an IPv4 A record.  The gethostbyname calls will succeed
elsewhere but, when it comes to actually creating the socket, we get
the IPv6 connection thanks to the getaddrinfo call.  I was scratching
my head TRYING to figure out WHY nobody had seen this before.  Now I
know.  It only breaks for IPv6-Only host names and works on IPv6/IPv4
dual address names for the wrong reason.  :-<

Ouch.

      OpenSock() only uses getaddrinfo in the INET6 case but OpenSSH
seems to use it unconditionally.  We've got calls to gethostbyname
in checkaliases.c, driver.c, and env.c (the one in socket.c is covered
by the ifdef on INET6_ENABLE).  The one in driver.c is the one causing
the immediate problem and seems the easiest one to fix.  That one
is just being used to derive the canonical name and should be easy
to replace with getaddrinfo.

Hum, does getaddrinfo work on Solaris 2.6?

      It looks like the ones in checkaliases.c could be a real mess,
though.  The one in env.c looks to be a problem only if we are running
from an IPv6-Only host and is less likely to occur, right now.  :-)

      There are also some checks in fetchmail.c for "HAVE_GETHOSTBYNAME"
which don't look like they do any harm but raise the question if that
check is valid when using getaddrinfo.

You'd certainly have to check for getaddrinfo in configure.in to avoid
surprises to portability.

-- 
Matthias Andree