|
|
801ff6 |
From 21ac960a3e648cd53c155bd2b724f72f0164416f Mon Sep 17 00:00:00 2001
|
|
|
801ff6 |
From: Matthias Andree <matthias.andree@gmx.de>
|
|
|
801ff6 |
Date: Fri, 17 Jun 2011 03:11:39 +0200
|
|
|
801ff6 |
Subject: [PATCH] Fix mimedecode last-line omission.
|
|
|
801ff6 |
|
|
|
801ff6 |
The mimedecode feature failed to ship the last line of the body if it
|
|
|
801ff6 |
was encoded as quoted-printable and had a MIME soft line break in the
|
|
|
801ff6 |
very last line. Reported by Lars Hecking in June 2011.
|
|
|
801ff6 |
|
|
|
801ff6 |
Bug introduced on 1998-03-20 when the mimedecode support was added by
|
|
|
801ff6 |
ESR before release 4.4.1 through code contributed by Henrik Storner,
|
|
|
801ff6 |
in driver.c.
|
|
|
801ff6 |
|
|
|
801ff6 |
Workaround for older releases: do not use mimedecode feature.
|
|
|
801ff6 |
---
|
|
|
801ff6 |
NEWS | 8 ++++++++
|
|
|
801ff6 |
transact.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--------------
|
|
|
801ff6 |
2 files changed, 53 insertions(+), 14 deletions(-)
|
|
|
801ff6 |
|
|
|
801ff6 |
diff --git a/NEWS b/NEWS
|
|
|
801ff6 |
index 26709e4..ac9bc42 100644
|
|
|
801ff6 |
--- a/NEWS
|
|
|
801ff6 |
+++ b/NEWS
|
|
|
801ff6 |
@@ -156,6 +156,14 @@ fetchmail-6.3.23 (released 2012-12-10, 26106 LoC):
|
|
|
801ff6 |
* Clean up logfile vs. syslog handling, and in case logfile overrides
|
|
|
801ff6 |
syslog, send a message to the latter stating where logging goes.
|
|
|
801ff6 |
|
|
|
801ff6 |
+# BUG FIXES
|
|
|
801ff6 |
+* The mimedecode feature failed to ship the last line of the body if it was
|
|
|
801ff6 |
+ encoded as quoted-printable and had a MIME soft line break in the very last
|
|
|
801ff6 |
+ line. Reported by Lars Hecking in June 2011.
|
|
|
801ff6 |
+ Bug introduced on 1998-03-20 when the mimedecode support was added by ESR
|
|
|
801ff6 |
+ before release 4.4.1 through code contributed by Henrik Storner.
|
|
|
801ff6 |
+ Workaround for older releases: do not use mimedecode feature.
|
|
|
801ff6 |
+
|
|
|
801ff6 |
# CHANGES
|
|
|
801ff6 |
* The build process can now be made a bit more silent and concise through
|
|
|
801ff6 |
./configure --enable-silent-rules, or by adding "V=0" to the make command.
|
|
|
801ff6 |
diff --git a/transact.c b/transact.c
|
|
|
801ff6 |
index ec8013a..5449e56 100644
|
|
|
801ff6 |
--- a/transact.c
|
|
|
801ff6 |
+++ b/transact.c
|
|
|
801ff6 |
@@ -1383,6 +1383,28 @@ process_headers:
|
|
|
801ff6 |
return PS_SOCKET;
|
|
|
801ff6 |
}
|
|
|
801ff6 |
|
|
|
801ff6 |
+/** Convenience function factored out from readbody():
|
|
|
801ff6 |
+ * send buffer \a buf via stuffline() and handle errors and progress.
|
|
|
801ff6 |
+ * Store return value in \a *n, and return PS_IOERR for failure or
|
|
|
801ff6 |
+ * PS_SUCCESS otherwise. */
|
|
|
801ff6 |
+static int rb_send(struct query *ctl, char *buf, int *n)
|
|
|
801ff6 |
+{
|
|
|
801ff6 |
+ *n = stuffline(ctl, buf);
|
|
|
801ff6 |
+
|
|
|
801ff6 |
+ if (*n < 0)
|
|
|
801ff6 |
+ {
|
|
|
801ff6 |
+ report(stdout, GT_("error writing message text\n"));
|
|
|
801ff6 |
+ release_sink(ctl);
|
|
|
801ff6 |
+ return(PS_IOERR);
|
|
|
801ff6 |
+ }
|
|
|
801ff6 |
+ else if (want_progress())
|
|
|
801ff6 |
+ {
|
|
|
801ff6 |
+ fputc('*', stdout);
|
|
|
801ff6 |
+ fflush(stdout);
|
|
|
801ff6 |
+ }
|
|
|
801ff6 |
+ return PS_SUCCESS;
|
|
|
801ff6 |
+}
|
|
|
801ff6 |
+
|
|
|
801ff6 |
int readbody(int sock, struct query *ctl, flag forward, int len)
|
|
|
801ff6 |
/** read and dispose of a message body presented on \a sock */
|
|
|
801ff6 |
/** \param ctl query control record */
|
|
|
801ff6 |
@@ -1478,7 +1500,7 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
|
|
|
801ff6 |
/* ship out the text line */
|
|
|
801ff6 |
if (forward && (!issoftline))
|
|
|
801ff6 |
{
|
|
|
801ff6 |
- int n;
|
|
|
801ff6 |
+ int n, err;
|
|
|
801ff6 |
inbufp = buf;
|
|
|
801ff6 |
|
|
|
801ff6 |
/* guard against very long lines */
|
|
|
801ff6 |
@@ -1486,22 +1508,31 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
|
|
|
801ff6 |
buf[MSGBUFSIZE+2] = '\n';
|
|
|
801ff6 |
buf[MSGBUFSIZE+3] = '\0';
|
|
|
801ff6 |
|
|
|
801ff6 |
- n = stuffline(ctl, buf);
|
|
|
801ff6 |
-
|
|
|
801ff6 |
- if (n < 0)
|
|
|
801ff6 |
- {
|
|
|
801ff6 |
- report(stdout, GT_("error writing message text\n"));
|
|
|
801ff6 |
- release_sink(ctl);
|
|
|
801ff6 |
- return(PS_IOERR);
|
|
|
801ff6 |
- }
|
|
|
801ff6 |
- else if (want_progress())
|
|
|
801ff6 |
- {
|
|
|
801ff6 |
- fputc('*', stdout);
|
|
|
801ff6 |
- fflush(stdout);
|
|
|
801ff6 |
- }
|
|
|
801ff6 |
+ err = rb_send(ctl, buf, &n);
|
|
|
801ff6 |
+ if (err != PS_SUCCESS)
|
|
|
801ff6 |
+ return err;
|
|
|
801ff6 |
}
|
|
|
801ff6 |
}
|
|
|
801ff6 |
|
|
|
801ff6 |
+ /* Flush buffer -- bug introduced by ESR on 1998-03-20 before
|
|
|
801ff6 |
+ * release 4.4.1 when ESR did not sufficiently audit Henrik
|
|
|
801ff6 |
+ * Storner's patch.
|
|
|
801ff6 |
+ * Trouble reported in June 2011 by Lars Hecking, with
|
|
|
801ff6 |
+ * text/html quoted-printable messages generated by
|
|
|
801ff6 |
+ * Outlook/Exchange that got mutilated by fetchmail.
|
|
|
801ff6 |
+ */
|
|
|
801ff6 |
+ if (forward && issoftline)
|
|
|
801ff6 |
+ {
|
|
|
801ff6 |
+ int n;
|
|
|
801ff6 |
+
|
|
|
801ff6 |
+ /* force proper line termination */
|
|
|
801ff6 |
+ inbufp[0] = '\r';
|
|
|
801ff6 |
+ inbufp[1] = '\n';
|
|
|
801ff6 |
+ inbufp[2] = '\0';
|
|
|
801ff6 |
+
|
|
|
801ff6 |
+ return rb_send(ctl, buf, &n);
|
|
|
801ff6 |
+ }
|
|
|
801ff6 |
+
|
|
|
801ff6 |
return(PS_SUCCESS);
|
|
|
801ff6 |
}
|
|
|
801ff6 |
|
|
|
801ff6 |
--
|
|
|
801ff6 |
1.7.1
|
|
|
801ff6 |
|