diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-12-08 18:43:22 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-12-08 18:43:22 +0000 |
commit | 6aee1918ce18f22aa93b62e58f3151c82cc00eb0 (patch) | |
tree | 2e010dbf0a994bfb709b5f0a08165a726e080805 | |
parent | 890a533ab98e8b4ef986dd257c7d0be261a2e4db (diff) | |
download | fetchmail-6aee1918ce18f22aa93b62e58f3151c82cc00eb0.tar.gz fetchmail-6aee1918ce18f22aa93b62e58f3151c82cc00eb0.tar.bz2 fetchmail-6aee1918ce18f22aa93b62e58f3151c82cc00eb0.zip |
Call res_init() at the beginning of the poll, if the computer has res_search().
This is supposed to re-read /etc/resolv.conf in order to pick up changes
made by dhcpcd, dhclient, pppd, openvpn or similar.
To fix Debian Bug #389270 (DNS errors in daemon mode) and others.
svn path=/branches/BRANCH_6-3/; revision=4986
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | TODO.txt | 3 | ||||
-rw-r--r-- | fetchmail.c | 21 |
3 files changed, 27 insertions, 3 deletions
@@ -79,6 +79,12 @@ fetchmail 6.3.6 (not yet released): * RPOP: The password is now shrouded in the local logs. * Robustness: If a stale lockfile cannot be deleted, truncate it to avoid trouble later if the PID is recycled by a non-fetchmail process. +* On systems that have res_search(), assume we also have res_init() and call it + (suggested by Ulrich Drepper, glibc bug #3675) in order to make libc or + libresolv reread the resolver configuration at the beginning of a poll cycle. + This is important when fetchmail is in daemon mode and /etc/resolv.conf is + changed later by dhcpcd, dhclient, pppd, openvpn or other ip-up/ipchange + scripts. Should fix Debian Bug#389270, Bug#391698. # TRANSLATIONS: * New en_GB (British English) translation by David Lodge. @@ -5,9 +5,6 @@ Götz Nimrill's authenticate external patch. - check manpage/fetchmail.h and code which exit statuses are actually used and clean up -- does libresolv or libc (glibc) or something cache resolver - addresses??? If so, that's a severe bug in the resp. lib. - Debian Bug #389270 (perhaps related to #391698). 6.3.7: - more SMTP/LMTP error detail on message rejections even outside verbose mode. diff --git a/fetchmail.c b/fetchmail.c index 443b1feb..6a33c3d7 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -45,6 +45,11 @@ #include "i18n.h" #include "lock.h" +/* need these (and sys/types.h) for res_init() */ +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + #ifndef ENETUNREACH #define ENETUNREACH 128 /* Interactive doesn't know this */ #endif /* ENETUNREACH */ @@ -669,6 +674,22 @@ int main(int argc, char **argv) sethostent(TRUE); /* use TCP/IP for mailserver queries */ #endif /* HAVE_RES_SEARCH */ +#ifdef HAVE_RES_SEARCH + /* Boldly assume that we also have res_init() if we have + * res_search(), and call res_init() to re-read the resolv.conf + * file, so that we can pick up changes to that file that are + * written by dhpccd, dhclient, pppd, openvpn and similar. */ + + /* NOTE: This assumes that /etc/resolv.conf is written + * atomically (i. e. a temporary file is written, flushed and + * then renamed into place). To fix Debian Bug#389270. */ + + /* NOTE: If this leaks memory or doesn't re-read + * /etc/resolv.conf, we're in trouble. The res_init() interface + * is only lightly documented :-( */ + res_init(); +#endif + activecount = 0; batchcount = 0; for (ctl = querylist; ctl; ctl = ctl->next) |