aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xfetchmailconf9
-rw-r--r--imap.c14
3 files changed, 22 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index f796b73e..fef03288 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@
* Added FAQ item on performance under load.
* Fix Debian bug #60202 (segfaults when given command line arguments).
This only applied to `antispam', as it turned out.
+* Work around InterChange's bug with attachments as suggested by
+ paul666@mailandnews.com.
fetchmail-5.3.3 (Mon Mar 13 16:34:29 EST 2000), 18763 lines:
diff --git a/fetchmailconf b/fetchmailconf
index 639eb088..585f2235 100755
--- a/fetchmailconf
+++ b/fetchmailconf
@@ -1259,9 +1259,12 @@ same messages will be downloaded over and over.
"""
if string.find(greetline, "InterChange") > 0:
warnings = warnings + """
-The InterChange IMAP server screws up on mail with attachments. It reports
-the message size with attachments included, but doesn't download them on a
-RETR or TOP (this violates the IMAP RFCs). You should get rid of it.
+The InterChange IMAP server screws up on mail with attachments. It
+doesn't fetch them if you give it a BODY[TEXT] request, though it
+does if you request RFC822.TEXT (according to the IMAP RFCs and their
+maintainer these should be equivalent). We have worked around this
+bug, but suspect InterChange is likely to be broken in other ways.
+You should get rid of it.
"""
if string.find(greetline, "Imail") > 0:
diff --git a/imap.c b/imap.c
index c9df435e..fe8bffe7 100644
--- a/imap.c
+++ b/imap.c
@@ -1246,15 +1246,29 @@ static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
* In that case, marking the seen flag is the only way to prevent the
* message from being re-fetched on subsequent runs (and according
* to RFC2060 p.43 this fetch should set Seen as a side effect).
+ *
+ * According to RFC2060, and Mark Crispin the IMAP maintainer,
+ * FETCH %d BODY[TEXT] and RFC822.TEXT are "functionally
+ * equivalent". However, we know of at least one server that
+ * treats them differently in the presence of MIME attachments;
+ * the latter form downloads the attachment, the former does not.
+ * The server is InterChange, and the fool who implemented this
+ * misfeature ought to be strung up by his thumbs.
+ *
+ * To work around this, we disable use of the 4rev1 form. It's
+ * all too easy to imagine other clever idiots deciding that the
+ * message body doesn't include attachments.
*/
switch (imap_version)
{
case IMAP4rev1: /* RFC 2060 */
+#ifdef __UNUSED__
if (!ctl->keep)
gen_send(sock, "FETCH %d BODY.PEEK[TEXT]", number);
else
gen_send(sock, "FETCH %d BODY[TEXT]", number);
break;
+#endif /* UNUSED -- FALL THROGH */
case IMAP4: /* RFC 1730 */
if (!ctl->keep)