aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2005-11-09 23:54:56 +0000
committerMatthias Andree <matthias.andree@gmx.de>2005-11-09 23:54:56 +0000
commita096f054c1ec695e8a23c5cbcdcb07d7d45c6495 (patch)
treec328422672e5d2f421e5385ee9315c8ae457dac3
parent20900c384516f3b993c5d8773014bbc4e52973c1 (diff)
downloadfetchmail-a096f054c1ec695e8a23c5cbcdcb07d7d45c6495.tar.gz
fetchmail-a096f054c1ec695e8a23c5cbcdcb07d7d45c6495.tar.bz2
fetchmail-a096f054c1ec695e8a23c5cbcdcb07d7d45c6495.zip
When eating 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. svn path=/trunk/; revision=4396
-rw-r--r--NEWS3
-rw-r--r--imap.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index ec8e5efa..feabf655 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/imap.c b/imap.c
index 00955946..3226f59d 100644
--- a/imap.c
+++ b/imap.c
@@ -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);