From a9ec148ec8b36acbf9184708ebbcc2d9f40adb31 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 14 Jun 2009 10:41:10 +0000 Subject: Merge and extend Redhat's AI_ADDRCONFIG patch. svn path=/branches/BRANCH_6-3/; revision=5357 --- NEWS | 3 +++ driver.c | 3 +++ socket.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 7a74badd..c9a6fc0b 100644 --- a/NEWS +++ b/NEWS @@ -108,6 +108,9 @@ fetchmail 6.3.10 (not yet released): * The sleeping at/awakened at messages appear in logfiles and syslog only if verbose mode is enabled. On the console, they will still appear without verbose mode. Fixes Debian Bug#282259. +* fetchmail only requests IPv6 addresses via name service if at least one is + configured on the local host, likewise for IPv4. (AI_ADDRCONFIG flag to + getaddrinfo()) Extended version of Redhat's patch. # CHANGES TO CONTRIB * Fix bashism in contrib/fetchsetup. Fixes Debian Bug#530081. diff --git a/driver.c b/driver.c index 4a2e3233..4a98442d 100644 --- a/driver.c +++ b/driver.c @@ -1010,6 +1010,9 @@ static int do_session( hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_CANONNAME; +#ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; +#endif error = fm_getaddrinfo(ctl->server.queryname, NULL, &hints, &res); if (error) diff --git a/socket.c b/socket.c index 51c15529..474928d0 100644 --- a/socket.c +++ b/socket.c @@ -276,6 +276,9 @@ int SockOpen(const char *host, const char *service, memset(&req, 0, sizeof(struct addrinfo)); req.ai_socktype = SOCK_STREAM; +#ifdef AI_ADDRCONFIG + req.ai_flags = AI_ADDRCONFIG; +#endif i = fm_getaddrinfo(host, service, &req, ai0); if (i) { -- cgit v1.2.3