From a096f054c1ec695e8a23c5cbcdcb07d7d45c6495 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 9 Nov 2005 23:54:56 +0000 Subject: 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 --- imap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'imap.c') 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); -- cgit v1.2.3