[Pkg-mailman-hackers] Pkg-mailman commit - rev 258 - in trunk/debian: . patches

Lionel Elie Mamane lmamane at costa.debian.org
Sun Dec 11 11:20:08 UTC 2005


Author: lmamane
Date: 2005-12-11 11:20:07 +0000 (Sun, 11 Dec 2005)
New Revision: 258

Added:
   trunk/debian/patches/77_header_folding_in_attachments.dpatch
Modified:
   trunk/debian/changelog
   trunk/debian/patches/00list
Log:
Bug#244673: Don't fold headers in attachments (breaks cryptographic signatures)


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-12-11 11:18:19 UTC (rev 257)
+++ trunk/debian/changelog	2005-12-11 11:20:07 UTC (rev 258)
@@ -21,8 +21,10 @@
        99_js_templates
     Bugs fixed upstream:
     - Possible data loss in archives (closes: #244699)
+  * Don't fold headers in attachments (closes: #244673)
+    This avoids breaking cryptographic signatures
 
- -- Lionel Elie Mamane <lmamane at debian.org>  Sat, 10 Dec 2005 13:08:40 +0100
+ -- Lionel Elie Mamane <lmamane at debian.org>  Sun, 11 Dec 2005 12:19:29 +0100
 
 mailman (2.1.5-11) UNRELEASED; urgency=low
 

Modified: trunk/debian/patches/00list
===================================================================
--- trunk/debian/patches/00list	2005-12-11 11:18:19 UTC (rev 257)
+++ trunk/debian/patches/00list	2005-12-11 11:20:07 UTC (rev 258)
@@ -31,4 +31,5 @@
 72_hyperarch_error_handling.dpatch
 74_admin_non-ascii_emails.dpatch
 76_fix-private-redirect.dpatch
+77_header_folding_in_attachments
 99_js_templates

Added: trunk/debian/patches/77_header_folding_in_attachments.dpatch
===================================================================
--- trunk/debian/patches/77_header_folding_in_attachments.dpatch	2005-12-11 11:18:19 UTC (rev 257)
+++ trunk/debian/patches/77_header_folding_in_attachments.dpatch	2005-12-11 11:20:07 UTC (rev 258)
@@ -0,0 +1,128 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 77_header_folding_in_attachments.dpatch by Lionel Elie Mamane <lionel at mamane.lu>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Don't fold headers into message/rfc822 attachments
+## DP: This avoids breaking signatures
+
+ at DPATCH@
+diff -urNad mailman-2.1.6~/Mailman/Generator.py mailman-2.1.6/Mailman/Generator.py
+--- mailman-2.1.6~/Mailman/Generator.py	1970-01-01 01:00:00.000000000 +0100
++++ mailman-2.1.6/Mailman/Generator.py	2005-12-11 12:13:13.928413754 +0100
+@@ -0,0 +1,55 @@
++# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
++#                    2005 Lionel Elie Mamane <lionel at mamane.lu>
++#
++# This program is free software; you can redistribute it and/or
++# modify it under the terms of the GNU General Public License
++# as published by the Free Software Foundation; either version 2
++# of the License, or (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++#
++# Author: Bernhard Reiter <bernhard at gnu.org>
++# Changed by Lionel Elie Mamane December 2005 from version on
++# http://ftp.intevation.de/users/bernhard/mailman/mailman-2.1.4-avoid-headerfolding-python21.diff
++# to use clone/children_maxheaderlen trick instead of _write_headers/mangle_from_
++
++"""Standard Mailman generator object.
++
++A subclass of email.Generator which only folds long headers
++in the top object level. 
++This is needed because Mailman should leave the reveiced message parts alone.
++Otherwise is might change subparts over which a signature was calculated,
++breaking it while doing so.
++"""
++
++import email
++import email.Generator
++
++try:
++    True, False
++except NameError:
++    True = 1
++    False = 0
++
++
++class Generator(email.Generator.Generator):
++    """Generates output from a Message object tree, keeping signatures.
++
++       Headers will by default _not_ be folded for in attachments.
++    """
++    def __init__(self, outfp, mangle_from_=False,
++                 children_maxheaderlen=0, toplevel_maxheaderlen=78):
++        email.Generator.Generator.__init__(self, outfp, maxheaderlen=toplevel_maxheaderlen, mangle_from_=mangle_from_)
++        self.__children_maxheaderlen = children_maxheaderlen
++
++    def clone(self, fp):
++        """Clone this generator with maxheaderlen set for children"""
++        return self.__class__(fp, self._mangle_from_, self.__children_maxheaderlen, self.__children_maxheaderlen)
++
+diff -urNad mailman-2.1.6~/Mailman/Mailbox.py mailman-2.1.6/Mailman/Mailbox.py
+--- mailman-2.1.6~/Mailman/Mailbox.py	2003-04-19 06:57:14.000000000 +0200
++++ mailman-2.1.6/Mailman/Mailbox.py	2005-12-11 12:11:50.696486982 +0100
+@@ -22,10 +22,10 @@
+ 
+ import email
+ from email.Parser import Parser
+-from email.Generator import Generator
+ from email.Errors import MessageParseError
+ 
+ from Mailman import mm_cfg
++from Mailman.Generator import Generator
+ from Mailman.Message import Message
+ 
+ try:
+@@ -65,7 +65,7 @@
+         # Seek to the last char of the mailbox
+         self.fp.seek(1, 2)
+         # Create a Generator instance to write the message to the file
+-        g = Generator(self.fp)
++        g = Generator(self.fp, mangle_from_=True)
+         g.flatten(msg, unixfrom=True)
+         # Add one more trailing newline for separation with the next message
+         # to be appended to the mbox.
+diff -urNad mailman-2.1.6~/Mailman/Message.py mailman-2.1.6/Mailman/Message.py
+--- mailman-2.1.6~/Mailman/Message.py	2005-04-29 14:04:48.000000000 +0200
++++ mailman-2.1.6/Mailman/Message.py	2005-12-11 12:11:50.697486851 +0100
+@@ -21,6 +21,8 @@
+ """
+ 
+ import re
++from cStringIO import StringIO
++
+ import email
+ import email.Message
+ import email.Utils
+@@ -31,6 +33,7 @@
+ 
+ from Mailman import mm_cfg
+ from Mailman import Utils
++from Mailman.Generator import Generator
+ 
+ COMMASPACE = ', '
+ 
+@@ -188,6 +191,16 @@
+             authors.append(address)
+         return authors
+ 
++    def as_string(self, unixfrom=False):
++        """Return entire formatted message as a string using Mailman.Generator.
++
++        Operates like email.Message.Message.as_string, only
++	using Mailman's Generator class. Only the top headers will get folded.
++        """
++        fp = StringIO()
++        g = Generator(fp)
++        g.flatten(self, unixfrom=unixfrom)
++        return fp.getvalue()
+ 
+ 
+ class UserNotification(Message):


Property changes on: trunk/debian/patches/77_header_folding_in_attachments.dpatch
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-mailman-hackers mailing list