[pkg-fetchmail-maint] Bug#312415: fetchmail: does not implement IMAP correctly

Matthias Andree matthias.andree at gmx.de
Fri May 12 01:52:08 UTC 2006


The attached patch has been committed to the upstream SVN repository
and is supposed to fix the issue.

-- 
Matthias Andree
-------------- next part --------------
Index: transact.c
===================================================================
--- transact.c	(Revision 4823)
+++ transact.c	(Revision 4824)
@@ -1335,6 +1335,9 @@
     while (protocol->delimited || len > 0)
     {
 	set_timeout(mytimeout);
+	/* XXX FIXME: for undelimited protocols that ship the size, such
+	 * as IMAP, we might want to use the count of remaining characters
+	 * instead of the buffer size -- not for fetchmail 6.3.X though */
 	if ((linelen = SockRead(sock, inbufp, sizeof(buf)-4-(inbufp-buf)))==-1)
 	{
 	    set_timeout(0);
@@ -1357,6 +1360,20 @@
 		sizeticker -= SIZETICKER;
 	    }
 	}
+
+	/* Mike Jones, Manchester University, 2006:
+	 * "To fix IMAP MIME Messages in which fetchmail adds the remainder of
+	 * the IMAP packet including the ')' character (part of the IMAP)
+	 * Protocol causing the addition of an extra MIME boundary locally."
+	 *
+	 * However, we shouldn't do this for delimited protocols:
+	 * many POP3 servers (Microsoft, qmail) goof up message sizes
+	 * so we might end truncating messages prematurely.
+	 */
+	if (!protocol->delimited && linelen > len) {
+	    inbufp[len] = '\0';
+	}
+
 	len -= linelen;
 
 	/* check for end of message */


More information about the pkg-fetchmail-maint mailing list