From 9efaf6e9906c97c30244293393239644416daa8b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 6 Jul 2001 02:10:04 +0000 Subject: Exit with DNS error only if all mailserver lookups fail. svn path=/trunk/; revision=3401 --- NEWS | 2 ++ fetchmail.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 618c557c..7beb8ed9 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ * Bug fix for envskip. * ODMR finally seems to be working. * Handle multiple backslashes within RFC822 address strings correctly. +* Don't exit on a failure to DNS-resolve a mailserver name, just + make it inactive. Exit only if all lookups fail. * Restore code to deal with SMTP error responses at RCPT TO time, but without issuing an RSET. This is intended to fix obscure bugs that show up in recentb Postfix releases and sendmail configurations that diff --git a/fetchmail.c b/fetchmail.c index 37fe3e1c..bac5a2f7 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -1169,7 +1169,10 @@ static int load_params(int argc, char **argv, int optind) report(stderr, _("couldn't find canonical DNS name of %s\n"), ctl->server.pollname); - exit(PS_DNS); + ctl->server.truename = xstrdup(ctl->server.queryname); + ctl->active = FALSE; + /* use this initially to flag DNS errors */ + ctl->wedged = TRUE; } else { ctl->server.truename=xstrdup((char *)namerec->h_name); @@ -1267,6 +1270,21 @@ static int load_params(int argc, char **argv, int optind) run.postmaster = "postmaster"; } + /* + * If all connections are wedged due to DNS errors, quit. This is + * important for the common case that you just have one connection. + */ + st = PS_DNS; + for (ctl = querylist; ctl; ctl = ctl->next) + if (!ctl->wedged) + st = 0; + if (st == PS_DNS) + { + (void) fprintf(stderr, + _("all mailserver name lookups failed, exiting\n")); + exit(PS_DNS); + } + return(implicitmode); } -- cgit v1.2.3