diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-08 22:11:54 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-08 22:11:54 +0000 |
commit | ddb6ad5e4757c872d8153072fed52de54561c6a6 (patch) | |
tree | 37bc4e471d35eff27f039775abb5134bd6893dcb /driver.c | |
parent | 62472c27003c5a45d01d35b7e39f7145fa6dda1d (diff) | |
download | fetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.tar.gz fetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.tar.bz2 fetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.zip |
We no longer attempt delivery to multidrop mailboxes in the presence
of DNS errors.
svn path=/trunk/; revision=519
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 28 |
1 files changed, 21 insertions, 7 deletions
@@ -120,12 +120,16 @@ static int is_host_alias(const char *name, struct query *ctl) return(TRUE); /* - * We treat DNS lookup failure as a negative on the theory that - * the mailserver's DNS server is `nearby' and should be able - * to respond quickly and reliably. Ergo if we get failure, - * the name isn't a mailserver alias. + * We know DNS service was up at the beginning of this poll cycle. + * If it's down, our nameserver has crashed. We don't want to try + * delivering the current message or anything else from this + * mailbox until it's back up. */ - else if ((he = gethostbyname(name)) && strcmp(ctl->canonical_name, he->h_name) == 0) + else if ((he = gethostbyname(name)) == (struct hostent *)NULL) + longjmp(restart, 2); + + /* DNS response is OK */ + else if (strcmp(ctl->canonical_name, he->h_name) == 0) return(TRUE); /* @@ -138,12 +142,15 @@ static int is_host_alias(const char *name, struct query *ctl) mxrecords = getmxrecords(name); + h_errno = 0; if (mxrecords == (struct mxentry *)NULL) if (h_errno == TRY_AGAIN) { sleep(1); continue; } + else if (h_errno) /* fatal error */ + longjmp(restart, 2); else break; @@ -628,7 +635,7 @@ int do_protocol(ctl, proto) struct query *ctl; /* parsed options with merged-in defaults */ const struct method *proto; /* protocol method table */ { - int ok; + int ok, js; void (*sigsave)(); #ifndef KERBEROS_V4 @@ -673,13 +680,20 @@ const struct method *proto; /* protocol method table */ sigsave = signal(SIGVTALRM, vtalarm_handler); vtalarm(mytimeout = ctl->timeout); - if (setjmp(restart) == 1) + if ((js = setjmp(restart)) == 1) { fprintf(stderr, "fetchmail: timeout after %d seconds waiting for %s.\n", ctl->timeout, ctl->servername); ok = PS_ERROR; } + else if (js == 2) + { + fprintf(stderr, + "fetchmail: nameserver evaporated during poll of %s.\n", + ctl->servername); + ok = PS_ERROR; + } else { char buf [POPBUFSIZE+1]; |