[mailman] fix #754898 - decode subjects

Jan Kaluža jkaluza at fedoraproject.org
Thu Dec 15 13:01:49 UTC 2011


commit b9a1df349a22cbf52aab312281cec9bf7bed80fe
Author: Jan Kaluza <hanzz.k at gmail.com>
Date:   Thu Dec 15 13:57:53 2011 +0100

    fix #754898 - decode subjects

 mailman-2.1.13-subject-decode.patch |   46 +++++++++++++++++++++++++++++++++++
 mailman.spec                        |    7 ++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/mailman-2.1.13-subject-decode.patch b/mailman-2.1.13-subject-decode.patch
new file mode 100644
index 0000000..6db49bc
--- /dev/null
+++ b/mailman-2.1.13-subject-decode.patch
@@ -0,0 +1,46 @@
+--- test-mailman-2.1/Mailman/Handlers/Tagger.py	2008-12-02 11:42:30.000000000 -0800
++++ test-mailman/Mailman/Handlers/Tagger.py	2011-11-17 12:19:33.375000000 -0800
+@@ -1,4 +1,4 @@
+-# Copyright (C) 2001-2008 by the Free Software Foundation, Inc.
++# Copyright (C) 2001-2011 by the Free Software Foundation, Inc.
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+@@ -23,6 +23,9 @@
+ import email.Iterators
+ import email.Parser
+ 
++from email.Header import decode_header
++
++from Mailman import Utils
+ from Mailman.Logging.Syslog import syslog
+ 
+ CRNL = '\r\n'
+@@ -34,10 +37,16 @@
+ def process(mlist, msg, msgdata):
+     if not mlist.topics_enabled:
+         return
++    # Helper function.  Return RFC 2047 decoded header as a string in the
++    # charset of the list's preferred language.
++    def _decode(h):
++        if not h:
++            return h
++        return Utils.oneline(h, Utils.GetCharSet(mlist.preferred_language))
+     # Extract the Subject:, Keywords:, and possibly body text
+     matchlines = []
+-    matchlines.append(msg.get('subject', None))
+-    matchlines.append(msg.get('keywords', None))
++    matchlines.append(_decode(msg.get('subject', None)))
++    matchlines.append(_decode(msg.get('keywords', None)))
+     if mlist.topics_bodylines_limit == 0:
+         # Don't scan any body lines
+         pass
+@@ -84,7 +93,7 @@
+     # the first numlines of body text.
+     lines = []
+     lineno = 0
+-    reader = list(email.Iterators.body_line_iterator(msg))
++    reader = list(email.Iterators.body_line_iterator(msg, decode=True))
+     while numlines is None or lineno < numlines:
+         try:
+             line = reader.pop(0)
diff --git a/mailman.spec b/mailman.spec
index 2df535b..e89c65d 100644
--- a/mailman.spec
+++ b/mailman.spec
@@ -1,7 +1,7 @@
 Summary: Mailing list manager with built in Web access
 Name: mailman
 Version: 2.1.14
-Release: 10%{?dist}
+Release: 11%{?dist}
 Epoch: 3
 Group: Applications/Internet
 Source0: ftp://ftp.gnu.org/pub/gnu/mailman/mailman-%{version}.tgz
@@ -40,6 +40,7 @@ Patch19: mailman-2.1.12-codage.patch
 Patch20: mailman-2.1.12-init-not-on.patch
 Patch21: mailman-2.1.13-env-python.patch
 Patch22: mailman-2.1.9-CVE-2011-0707.patch
+Patch23: mailman-2.1.13-subject-decode.patch
 
 License: GPLv2+
 URL: http://www.list.org/
@@ -139,6 +140,7 @@ additional installation steps, these are described in:
 %patch20 -p1
 %patch21 -p1
 %patch22
+%patch23 -p1
 
 #cp $RPM_SOURCE_DIR/mailman.INSTALL.REDHAT.in INSTALL.REDHAT.in
 cp %{SOURCE5} INSTALL.REDHAT.in
@@ -540,6 +542,9 @@ exit 0
 %attr(2770,%{cgiuser},%{mmgroup}) %{archivesdir}/private
 
 %changelog
+* Thu Dec 15 2011 Jan Kaluza <jkaluza at redhat.com> - 3:2.1.14-11
+- fix #754898 - decode subjects
+
 * Wed Oct 12 2011 Jan Kaluza <jkaluza at redhat.com> - 3:2.1.14-10
 - fix #745411 - remove Indexes from httpd config
 


More information about the scm-commits mailing list