diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | conf.c | 5 | ||||
-rw-r--r-- | configure.in | 20 | ||||
-rw-r--r-- | socket.c | 36 |
4 files changed, 36 insertions, 26 deletions
@@ -9,6 +9,7 @@ a different host than the one fetchmail runs on, and on using ssh for a secure passwordless connection. Removed the FAQ entry on popclient. +* Jun-ichiro itojun Hagino <itojun@iijlab.net> sent a fix for IPv6. fetchmail-5.3.0 (Tue Feb 22 08:53:31 PST 2000), 18618 lines: @@ -249,9 +249,10 @@ void dump_config(struct runctl *runp, struct query *querylist) stringdump("via", ctl->server.via); stringdump("protocol", using_kpop ? "KPOP" : showproto(ctl->server.protocol)); +#ifndef INET6_ENABLE numdump("port", ctl->server.port); -#if INET6_ENABLE - stringdump("service", ctl->server.service); +#else + stringdump("port", ctl->server.service); #endif numdump("timeout", ctl->server.timeout); numdump("interval", ctl->server.interval); diff --git a/configure.in b/configure.in index c1a1aede..6abadb60 100644 --- a/configure.in +++ b/configure.in @@ -501,13 +501,10 @@ fi]) AC_ARG_WITH(hesiod, [ --with-hesiod=DIR point fetchmail compilation at a HESIOD directory]) -if test -n "$with_hesiod" -then - # Path given - CEFLAGS="$CEFLAGS -DHESIOD -I$with_hesiod/include" - LDEFLAGS="$LDEFLAGS -L$with_hesiod/lib" - LIBS="$LIBS -lhesiod" -else +case "x$with_hesiod" in +xno) + ;; +x) for dir in /usr/athena /usr /usr/local do if test -f "$dir/include/hesiod.h" @@ -519,7 +516,14 @@ else break fi done - fi + ;; +*) + # Path given + CEFLAGS="$CEFLAGS -DHESIOD -I$with_hesiod/include" + LDEFLAGS="$LDEFLAGS -L$with_hesiod/lib" + LIBS="$LIBS -lhesiod" + ;; + esac fi ### use option --with-gssapi=DIR to compile in GSSAPI support @@ -121,7 +121,7 @@ int SockCheckOpen(int fd) int SockOpen(const char *host, const char *service, const char *options, const char *plugin) { - struct addrinfo *ai, req; + struct addrinfo *ai, *ai0, req; int i; #if NET_SECURITY void *request = NULL; @@ -135,10 +135,10 @@ int SockOpen(const char *host, const char *service, const char *options, memset(&req, 0, sizeof(struct addrinfo)); req.ai_socktype = SOCK_STREAM; - if (getaddrinfo(host, service, &req, &ai)) { + if (getaddrinfo(host, service, &req, &ai0)) { report(stderr, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service); return -1; - }; + } #if NET_SECURITY if (!options) @@ -147,32 +147,36 @@ int SockOpen(const char *host, const char *service, const char *options, if (net_security_strtorequest((char *)options, &request, &requestlen)) goto ret; - i = inner_connect(ai, request, requestlen, NULL, NULL, "fetchmail", NULL); + i = inner_connect(ai0, request, requestlen, NULL, NULL, "fetchmail", NULL); if (request) free(request); ret: #else /* NET_SECURITY */ #ifdef HAVE_INNER_CONNECT - i = inner_connect(ai, NULL, 0, NULL, NULL, "fetchmail", NULL); + i = inner_connect(ai0, NULL, 0, NULL, NULL, "fetchmail", NULL); + if (i >= 0) + break; #else - i = socket(ai->ai_family, ai->ai_socktype, 0); - if (i < 0) { - freeaddrinfo(ai); - return -1; - } - if (connect(i, (struct sockaddr *) ai->ai_addr, ai->ai_addrlen) < 0) { - freeaddrinfo(ai); - close(i); /* don't use SockClose, no traffic yet */ - return -1; + i = -1; + for (ai = ai0; ai; ai = ai->ai_next) { + i = socket(ai->ai_family, ai->ai_socktype, 0); + if (i < 0) + continue; + if (connect(i, (struct sockaddr *) ai->ai_addr, ai->ai_addrlen) < 0) { + close(i); + i = -1; + continue; + } + break; } #endif #endif /* NET_SECURITY */ - freeaddrinfo(ai); + freeaddrinfo(ai0); return i; -}; +} #else /* INET6_ENABLE */ #ifndef HAVE_INET_ATON #ifndef INADDR_NONE |