[fetchmail/f18] Fix fetchmail loses last line of message if the non-default mimedecode option is enabled and if that
vcrhonek
vcrhonek at fedoraproject.org
Thu Apr 25 11:25:03 UTC 2013
commit e2c07f7d6b9e180813b393a81bf0e127d2e5e6aa
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date: Thu Apr 25 13:23:17 2013 +0200
Fix fetchmail loses last line of message if the non-default mimedecode option is enabled and if that line is not properly terminated
fetchmail-6.3.24-data-loss.patch | 109 ++++++++++++++++++++++++++++++++++++++
fetchmail.spec | 10 +++-
2 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/fetchmail-6.3.24-data-loss.patch b/fetchmail-6.3.24-data-loss.patch
new file mode 100644
index 0000000..1391474
--- /dev/null
+++ b/fetchmail-6.3.24-data-loss.patch
@@ -0,0 +1,109 @@
+From 21ac960a3e648cd53c155bd2b724f72f0164416f Mon Sep 17 00:00:00 2001
+From: Matthias Andree <matthias.andree at gmx.de>
+Date: Fri, 17 Jun 2011 03:11:39 +0200
+Subject: [PATCH] Fix mimedecode last-line omission.
+
+The mimedecode feature failed to ship the last line of the body if it
+was encoded as quoted-printable and had a MIME soft line break in the
+very last line. Reported by Lars Hecking in June 2011.
+
+Bug introduced on 1998-03-20 when the mimedecode support was added by
+ESR before release 4.4.1 through code contributed by Henrik Storner,
+in driver.c.
+
+Workaround for older releases: do not use mimedecode feature.
+---
+ NEWS | 8 ++++++++
+ transact.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--------------
+ 2 files changed, 53 insertions(+), 14 deletions(-)
+
+diff --git a/transact.c b/transact.c
+index ec8013a..5449e56 100644
+--- a/transact.c
++++ b/transact.c
+@@ -1383,6 +1383,28 @@ process_headers:
+ return PS_SOCKET;
+ }
+
++/** Convenience function factored out from readbody():
++ * send buffer \a buf via stuffline() and handle errors and progress.
++ * Store return value in \a *n, and return PS_IOERR for failure or
++ * PS_SUCCESS otherwise. */
++static int rb_send(struct query *ctl, char *buf, int *n)
++{
++ *n = stuffline(ctl, buf);
++
++ if (*n < 0)
++ {
++ report(stdout, GT_("error writing message text\n"));
++ release_sink(ctl);
++ return(PS_IOERR);
++ }
++ else if (want_progress())
++ {
++ fputc('*', stdout);
++ fflush(stdout);
++ }
++ return PS_SUCCESS;
++}
++
+ int readbody(int sock, struct query *ctl, flag forward, int len)
+ /** read and dispose of a message body presented on \a sock */
+ /** \param ctl query control record */
+@@ -1478,7 +1500,7 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
+ /* ship out the text line */
+ if (forward && (!issoftline))
+ {
+- int n;
++ int n, err;
+ inbufp = buf;
+
+ /* guard against very long lines */
+@@ -1486,22 +1508,31 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
+ buf[MSGBUFSIZE+2] = '\n';
+ buf[MSGBUFSIZE+3] = '\0';
+
+- n = stuffline(ctl, buf);
+-
+- if (n < 0)
+- {
+- report(stdout, GT_("error writing message text\n"));
+- release_sink(ctl);
+- return(PS_IOERR);
+- }
+- else if (want_progress())
+- {
+- fputc('*', stdout);
+- fflush(stdout);
+- }
++ err = rb_send(ctl, buf, &n);
++ if (err != PS_SUCCESS)
++ return err;
+ }
+ }
+
++ /* Flush buffer -- bug introduced by ESR on 1998-03-20 before
++ * release 4.4.1 when ESR did not sufficiently audit Henrik
++ * Storner's patch.
++ * Trouble reported in June 2011 by Lars Hecking, with
++ * text/html quoted-printable messages generated by
++ * Outlook/Exchange that got mutilated by fetchmail.
++ */
++ if (forward && issoftline)
++ {
++ int n;
++
++ /* force proper line termination */
++ inbufp[0] = '\r';
++ inbufp[1] = '\n';
++ inbufp[2] = '\0';
++
++ return rb_send(ctl, buf, &n);
++ }
++
+ return(PS_SUCCESS);
+ }
+
+--
+1.7.1
+
diff --git a/fetchmail.spec b/fetchmail.spec
index cc3b228..d27e905 100644
--- a/fetchmail.spec
+++ b/fetchmail.spec
@@ -3,7 +3,7 @@
Summary: A remote mail retrieval and forwarding utility
Name: fetchmail
Version: 6.3.22
-Release: 1%{?dist}
+Release: 2%{?dist}
Source0: http://download.berlios.de/fetchmail/fetchmail-%{version}.tar.xz
Source1: http://download.berlios.de/fetchmail/fetchmail-%{version}.tar.xz.asc
URL: http://fetchmail.berlios.de/
@@ -12,6 +12,8 @@ License: GPL+ and Public Domain
Group: Applications/Internet
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext-devel hesiod-devel krb5-devel openssl-devel
+# Patch0: already upstream
+Patch0: fetchmail-6.3.24-data-loss.patch
%description
Fetchmail is a remote mail retrieval and forwarding utility intended
@@ -26,6 +28,7 @@ connections.
%prep
%setup -q
+%patch0 -p1 -b .data-loss
%build
%configure --enable-POP3 --enable-IMAP --with-ssl --with-hesiod \
@@ -55,6 +58,11 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/fetchmail.1*
%changelog
+* Thu Apr 25 2013 Vitezslav Crhonek <vcrhonek at redhat.com> - 6.3.22-2
+- Fix fetchmail loses last line of message if the non-default "mimedecode" option
+ is enabled and if that line is not properly terminated
+ Resolves: #955814
+
* Wed Sep 05 2012 Vitezslav Crhonek <vcrhonek at redhat.com> - 6.3.22-1
- Update to fetchmail-6.3.22
More information about the scm-commits
mailing list