]> Pileus Git - ~andy/fetchmail/commitdiff
fetchmail workaround for a bug in Zimbra
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 18 Nov 2011 23:43:11 +0000 (18:43 -0500)
committerMatthias Andree <matthias.andree@gmx.de>
Tue, 22 Nov 2011 00:44:52 +0000 (01:44 +0100)
Zimbra occasionally returns this response:

fetchmail: IMAP> A0007 FETCH 1 RFC822.HEADER
fetchmail: IMAP< * 1 FETCH ()
fetchmail: IMAP< A0007 OK FETCH completed

It happens when there is a corrupted message without a header in the
database. (I don't know how this message could be created, I just see it
there).

When fetchmail encounters such resonse, it gives up and disconnects.

This patch changes it so that PS_TRANSIENT is returned in this
case and fetchmail continues to fetch following messages correctly.

imap.c

diff --git a/imap.c b/imap.c
index 5c3218d0d7c2ecd4e7028a3878647ecbef228600..93f05f2c6ba7ba7cb392cd587550092944329188 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -1166,7 +1166,8 @@ static int imap_fetch_headers(int sock, struct query *ctl,int number,int *lenp)
 
        /* try to recover for some responses */
        if (!strncmp(buf, "* NO", 4) ||
-               !strncmp(buf, "* BAD", 5))
+               !strncmp(buf, "* BAD", 5) ||
+               strstr(buf, "FETCH ()"))
        {
            return(PS_TRANSIENT);
        }