diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-07-03 21:50:16 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-07-03 21:50:16 +0000 |
commit | 506cc73eb32fd40ad34e1e2e093b99c87a6ac2e1 (patch) | |
tree | 665942ca18806939724b5f79854463b4e823e23d | |
parent | 0881df42aeb7104a7197f26938819204ad6d5712 (diff) | |
download | fetchmail-506cc73eb32fd40ad34e1e2e093b99c87a6ac2e1.tar.gz fetchmail-506cc73eb32fd40ad34e1e2e093b99c87a6ac2e1.tar.bz2 fetchmail-506cc73eb32fd40ad34e1e2e093b99c87a6ac2e1.zip |
Use getaddrinfo to canonicalize hostnames if INET6_ENABLE. Patch by Matthias Andree.
svn path=/trunk/; revision=4078
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | driver.c | 33 |
3 files changed, 42 insertions, 4 deletions
@@ -93,6 +93,8 @@ fetchmail 6.3.0 (not yet released officially): (Matthias Andree). * Internationalization (i18n) updates by Miloslav Trmac. (Matthias Andree) +* Matthias Andree's fix for "couldn't find canonical DNS name of NN + (MM)" for hosts that have only IPv6 addresses. fetchmail-6.2.5 (Wed Oct 15 18:39:22 EDT 2003), 23079 lines: diff --git a/configure.ac b/configure.ac index 06110c4e..500c8d1e 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ dnl dnl Process this file with autoconf to produce a configure script. dnl -AC_INIT([fetchmail],[6.2.6]) +AC_INIT([fetchmail],[6.2.6.alpha2]) AC_CONFIG_SRCDIR([fetchmail.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_LIBOBJ_DIR([.]) @@ -29,7 +29,7 @@ AC_TYPE_SIGNAL AC_CHECK_HEADERS([unistd.h termios.h termio.h sgtty.h stdarg.h \ alloca.h sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h \ arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h \ - sys/select.h sys/time.h langinfo.h]) + sys/select.h sys/socket.h sys/time.h langinfo.h]) AC_CHECK_HEADERS([resolv.h],,,[ #include <sys/types.h> #ifdef HAVE_NETINET_IN_H @@ -345,8 +345,13 @@ AC_ARG_ENABLE(opie, [with_opie=no]) test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE,1,Define if you want OPIE support compiled in) +### XXX FIXME: the inet6-apps library is no longer available, +### http://www.inner.net/pub/ipv6/ states, as of 2005-07-03: +### "/pub/ipv6 +### Our IPv6 software is now long defunct. Please find a more modern +### source." AC_ARG_ENABLE(inet6, - [ --enable-inet6 support IPv6 (requires the inet6-apps library)], + [ --enable-inet6 support IPv6], [ AC_CHECK_FUNC(getaddrinfo, [with_inet6=yes], [ LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; @@ -28,6 +28,9 @@ #include <sys/wait.h> #endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif #ifdef HAVE_NET_SOCKET_H #include <net/socket.h> #endif @@ -1005,8 +1008,35 @@ static int do_session( } else { +#ifdef INET6_ENABLE + struct addrinfo hints, *res; + int error; + + memset(&hints, sizeof(hints), 0); + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = AF_UNSPEC; + hints.ai_flags = AI_CANONNAME; + + error = getaddrinfo(ctl->server.queryname, NULL, &hints, &res); + if (error) + { + report(stderr, + GT_("couldn't find canonical DNS name of %s (%s)\n"), + ctl->server.pollname, ctl->server.queryname); + err = PS_DNS; + set_timeout(0); + phase = oldphase; + goto closeUp; + } + else + { + ctl->server.truename=xstrdup(res->ai_canonname); + ctl->server.trueaddr=xmalloc(res->ai_addrlen); + memcpy(ctl->server.trueaddr, res->ai_addr, res->ai_addrlen); + } +#else struct hostent *namerec; - + /* * Get the host's IP, so we can report it like this: * @@ -1032,6 +1062,7 @@ static int do_session( namerec->h_addr_list[0], namerec->h_length); } +#endif } } #endif /* HAVE_GETHOSTBYNAME */ |