|
From: Sunil S. <sh...@bo...> - 2005-12-17 07:09:38
|
Quoting from Jason White's mail on Sat, Dec 17, 2005:
> On Fri, Dec 16, 2005 at 05:01:58PM +0530, Sunil Shetye wrote:
>
> > Your IMAP server is also sending UID information in the response. It
> > needs to be checked if sending UIDs in response is valid or not.
> Yes, I was wondering whether the server was conforming to the RFC.
> >
> > fetchmail is not expecting UIDs in the response. Hence the protocol
> > error. Could you try this patch and tell me if it works for you? Note
> > that you may get more errors if UIDs are sent in further responses
> > (like RFC822.TEXT) which have not been reached yet.
> With the patch applied, Fetchmail read and delivered the entire message. Here
> is the log of the body portion:
> Dec 17 10:38:26 jdc fetchmail[4404]: IMAP> A0007 FETCH 1 BODY.PEEK[TEXT]
> Dec 17 10:38:26 jdc fetchmail[4404]: IMAP< * 1 FETCH (UID 17 BODY[TEXT] {94}
> Dec 17 10:38:26 jdc fetchmail[4404]: (94 body octets)
> Dec 17 10:38:26 jdc fetchmail[4404]: IMAP< )
>
> Dec 17 10:38:26 jdc fetchmail[4404]: IMAP< A0007 OK FETCH completed
>
> I can carry out whatever further testing you consider appropriate, either to
> this or to any generalized version of the patch that you decide to create.
> I haven't tried messages with attachments yet, but thought I should report the
> initial results.
Thanks for your update. It looks like the code reading the response to
BODY[TEXT] is far more liberal. So, no further patches and tests are
required.
Here is the same patch with comments updated.
Matthias, please consider this patch for 6.3.1.
Index: fetchmail/imap.c
===================================================================
--- fetchmail/imap.c (revision 4550)
+++ fetchmail/imap.c (working copy)
@@ -880,8 +880,24 @@
if (num >= first && num <= last)
sizes[num - first] = size;
else
- report(stderr, "Warning: ignoring bogus data for message sizes returned by the server.\n");
+ report(stderr,
+ GT_("Warning: ignoring bogus data for message sizes returned by the server.\n"));
}
+ /* some servers (like mail.internode.on.net bld-mail04) return UID information here
+ *
+ * IMAP> A0005 FETCH 1 RFC822.SIZE
+ * IMAP< * 1 FETCH (UID 16 RFC822.SIZE 1447)
+ * IMAP< A0005 OK FETCH completed
+ *
+ */
+ else if (sscanf(buf, "* %u FETCH (UID %*s RFC822.SIZE %u)", &num, &size) == 2)
+ {
+ if (num >= first && num <= last)
+ sizes[num - first] = size;
+ else
+ report(stderr,
+ GT_("Warning: ignoring bogus data for message sizes returned by the server.\n"));
+ }
}
return(PS_SUCCESS);
@@ -948,8 +964,19 @@
if ((ok = gen_recv(sock, buf, sizeof(buf))))
return(ok);
ptr = skip_token(buf); /* either "* " or "AXXXX " */
- if (sscanf(ptr, "%d FETCH (%*s {%d}", &num, lenp) == 2)
+ if (sscanf(ptr, "%d FETCH (RFC822.HEADER {%d}", &num, lenp) == 2)
break;
+ /* some servers (like mail.internode.on.net bld-mail04) return UID information here
+ *
+ * IMAP> A0006 FETCH 1 RFC822.HEADER
+ * IMAP< * 1 FETCH (UID 16 RFC822.HEADER {1360}
+ * ...
+ * IMAP< )
+ * IMAP< A0006 OK FETCH completed
+ *
+ */
+ else if (sscanf(ptr, "%d FETCH (UID %*s RFC822.HEADER {%d}", &num, lenp) == 2)
+ break;
/* try to recover from chronically fucked-up M$ Exchange servers */
else if (!strncmp(ptr, "NO", 2))
{
--
Sunil Shetye.
|