diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | imap.c | 11 |
2 files changed, 10 insertions, 4 deletions
@@ -264,6 +264,9 @@ fetchmail 6.3.0 (not yet released officially): Bug#320645. Matthias Andree * fetchmail.man: Fix Debian Bug#241883, making global options more clear. Matt Swift, Matthias Andree. +* When eating IMAP message trailer, don't see any line containing "OK" as the + end of the trailer, but wait for the proper tagged OK line. To work around + the qmail + Courier-IMAP problem in Debian Bug#338007. Matthias Andree # INTERNAL CHANGES * Switched to automake. Matthias Andree. @@ -1039,7 +1039,7 @@ static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp) return(PS_SUCCESS); } -static int imap_trail(int sock, struct query *ctl, int number) +static int imap_trail(int sock, struct query *ctl, int number, const char *tag) /* discard tail of FETCH response after reading message text */ { /* expunges change the fetch numbers */ @@ -1047,15 +1047,18 @@ static int imap_trail(int sock, struct query *ctl, int number) for (;;) { - char buf[MSGBUFSIZE+1]; + char buf[MSGBUFSIZE+1], *t; int ok; if ((ok = gen_recv(sock, buf, sizeof(buf)))) return(ok); /* UW IMAP returns "OK FETCH", Cyrus returns "OK Completed" */ - if (strstr(buf, "OK")) - break; + if (strncmp(buf, tag, strlen(tag)) == 0) { + t = buf + strspn(t, " \t"); + if (strncmp(t, "OK", 2)) + break; + } } return(PS_SUCCESS); |