]> Pileus Git - ~andy/fetchmail/commitdiff
Localize the effect of DNS errors.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 21 Feb 1997 04:32:42 +0000 (04:32 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 21 Feb 1997 04:32:42 +0000 (04:32 -0000)
svn path=/trunk/; revision=908

NEWS
driver.c
fetchmail.man

diff --git a/NEWS b/NEWS
index ce3cab031db8917f31b4c9f867e2354eb031a627..3e63c2499200b0a8daee0e5a8af8b24479a3e842 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ features --
 
 * Treat unexpected EOF as a protocol error.
 
+* DNS errors no longer abort an entire poll.  Instead they just cause 
+  forwarding and deletion of the current message.  
+
 * -v output now includes the version/pl numbers (help for harried maintainer!).
 
 bugs --
index 24f7125a9cbe013c52636141ec7d3515370f78d8..3628e2663c3e70765ebdabb9e12e17c153b3d074 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -146,7 +146,6 @@ static int is_host_alias(const char *name, struct query *ctl)
                "nameserver failure while looking for `%s' during poll of %s.",
                name, ctl->server.names->id);
            ctl->errcount++;
-           longjmp(restart, 2);        /* try again next poll cycle */
            break;
        }
 
@@ -172,7 +171,6 @@ static int is_host_alias(const char *name, struct query *ctl)
                "nameserver failure while looking for `%s' during poll of %s.",
                name, ctl->server.names->id);
            ctl->errcount++;
-           longjmp(restart, 2);        /* try again next poll cycle */
            break;
        }
     }
@@ -435,10 +433,12 @@ char *realname;           /* real name of host */
 #ifdef HAVE_RES_SEARCH
     int                        no_local_matches = FALSE;
 #endif /* HAVE_RES_SEARCH */
+    int                        olderrs;
 
     sizeticker = 0;
     delete_ok = TRUE;
     remaining = len;
+    olderrs = ctl->errcount;
 
     /* read message headers */
     headers = received_for = return_path = NULL;
@@ -627,8 +627,18 @@ char *realname;            /* real name of host */
 #endif /* HAVE_RES_SEARCH */
        save_str(&xmit_names, -1, ctl->localnames->id);
 
-    /* time to address the message */
-    if (ctl->mda)      /* we have a declared MDA */
+
+    /*
+     * Time to either address the message or decide we can't deliver it yet.
+     */
+    if (ctl->errcount > olderrs)       /* there were DNS errors above */
+    {
+       delete_ok = FALSE;
+       sinkfp = (FILE *)NULL;
+       if (outlevel == O_VERBOSE)
+           error(0,0, "forwarding and deletion suppressed due to DNS errors");
+    }
+    else if (ctl->mda)         /* we have a declared MDA */
     {
        int     length = 0;
        char    *names, *cmd;
@@ -1045,6 +1055,7 @@ char *realname;           /* real name of host */
        if (SMTP_eom(sinkfp) != SM_OK)
        {
            error(0, 0, "SMTP listener refused delivery");
+           ctl->errcount++;
            return(PS_TRANSIENT);
        }
     }
@@ -1146,11 +1157,6 @@ const struct method *proto;      /* protocol method table */
                ctl->server.timeout, ctl->server.names->id);
        ok = PS_ERROR;
     }
-    else if (js == 2)
-    {
-       /* error message printed at point of longjmp */
-       ok = PS_ERROR;
-    }
     else
     {
        char buf [POPBUFSIZE+1];
index 2546a8008c50d2bd985def4c7b0ae2a32423f1f3..ebc68127169a18f69a06ca807b4530e0167c3e5a 100644 (file)
@@ -464,13 +464,14 @@ The
 or --nodetach option suppresses detachment of the daemon process
 from its control terminal.  This is primarily useful for debugging.
 .PP
-Note that while running in daemon mode, transient errors (such as DNS
-failures or sendmail delivery refusals) may force the fetchall
-option on for the duration of the next polling cycle.
+Note that while running in daemon mode polling a POP server, transient
+errors (such as DNS failures or sendmail delivery refusals) may force
+the fetchall option on for the duration of the next polling cycle.
 This is a robustness feature.  It means that if a message is fetched
-(and thus marked seen by the mailserver) but not delivered locally
-due to some transient error, it will be re-fetched during the next
-poll cycle.
+(and thus marked seen by the mailserver) but not delivered locally due
+to some transient error, it will be re-fetched during the next poll
+cycle.  (The IMAP logic doesn't delete messages until they're
+delivered, so this problem does not arise.)
 
 .SH RETRIEVAL FAILURE MODES
 The protocols \fIfetchmail\fR uses to talk to mailservers are next to