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

Lionel Elie Mamane lmamane-guest at costa.debian.org
Sun Nov 13 16:16:16 UTC 2005


Author: lmamane-guest
Date: 2005-11-13 16:16:15 +0000 (Sun, 13 Nov 2005)
New Revision: 221

Added:
   trunk/debian/patches/70_invalid_utf8_dos.dpatch
Modified:
   trunk/debian/changelog
Log:
A first shot at #327732


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-11-13 14:56:06 UTC (rev 220)
+++ trunk/debian/changelog	2005-11-13 16:16:15 UTC (rev 221)
@@ -1,9 +1,11 @@
-mailman (2.1.5-10) unstable; urgency=low
+mailman (2.1.5-10) UNRELEASED; urgency=high
 
   * Merge with 2.1.5-8ubuntu2:
     Python 2.4 compatibility patch in bounce handling.
+  * Don't fall apart if the filename of an attachment is an invalid UTF-8
+    string (closes: #327732)
 
- --
+ -- Lionel Elie Mamane <lmamane at debian.org>  Sun, 13 Nov 2005 15:41:15 +0100
 
 mailman (2.1.5-9) unstable; urgency=medium
 

Added: trunk/debian/patches/70_invalid_utf8_dos.dpatch
===================================================================
--- trunk/debian/patches/70_invalid_utf8_dos.dpatch	2005-11-13 14:56:06 UTC (rev 220)
+++ trunk/debian/patches/70_invalid_utf8_dos.dpatch	2005-11-13 16:16:15 UTC (rev 221)
@@ -0,0 +1,46 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 70_invalid_utf8_dos.dpatch by  <lionel at mamane.lu>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Avoid DOS if attachement filename is invalid Unicode string
+
+ at DPATCH@
+diff -urNad mailman-2.1.5~/Mailman/Handlers/Scrubber.py mailman-2.1.5/Mailman/Handlers/Scrubber.py
+--- mailman-2.1.5~/Mailman/Handlers/Scrubber.py	2003-12-01 02:43:18.000000000 +0100
++++ mailman-2.1.5/Mailman/Handlers/Scrubber.py	2005-11-13 15:29:26.585952860 +0100
+@@ -266,7 +266,10 @@
+             finally:
+                 os.umask(omask)
+             desc = part.get('content-description', _('not available'))
+-            filename = part.get_filename(_('not available'))
++            try:
++                filename = part.get_filename(_('not available'))
++            except UnicodeDecodeError:
++                filename = _('not available')
+             del part['content-type']
+             del part['content-transfer-encoding']
+             part.set_payload(_("""\
+@@ -356,7 +359,10 @@
+     # e.g. image/jpg (should be image/jpeg).  For now we just store such
+     # things as application/octet-streams since that seems the safest.
+     ctype = msg.get_content_type()
+-    fnext = os.path.splitext(msg.get_filename(''))[1]
++    try:
++        fnext = os.path.splitext(msg.get_filename(''))[1]
++    except UnicodeDecodeError:
++        fnext = ''
+     ext = guess_extension(ctype, fnext)
+     if not ext:
+         # We don't know what it is, so assume it's just a shapeless
+@@ -375,7 +381,10 @@
+     try:
+         # Now base the filename on what's in the attachment, uniquifying it if
+         # necessary.
+-        filename = msg.get_filename()
++        try:
++            filename = msg.get_filename()
++        except UnicodeDecodeError:
++            filename = None
+         if not filename:
+             filebase = 'attachment'
+         else:


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




More information about the Pkg-mailman-hackers mailing list