aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-08 22:11:54 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-08 22:11:54 +0000
commitddb6ad5e4757c872d8153072fed52de54561c6a6 (patch)
tree37bc4e471d35eff27f039775abb5134bd6893dcb /driver.c
parent62472c27003c5a45d01d35b7e39f7145fa6dda1d (diff)
downloadfetchmail-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.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/driver.c b/driver.c
index 325383ce..11cde20a 100644
--- a/driver.c
+++ b/driver.c
@@ -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];