------------------------------------------------------------
revno: 1485
fixes bug: https://launchpad.net/bugs/1318025
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Fri 2014-05-09 12:19:29 -0700
message:
  Handle missing From: header addresses for DMARC mitigation actions.
  (LP: #1318025)
modified:
  Mailman/Handlers/CookHeaders.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Handlers/CookHeaders.py'
--- Mailman/Handlers/CookHeaders.py	2014-05-05 01:54:04 +0000
+++ Mailman/Handlers/CookHeaders.py	2014-05-09 19:19:29 +0000
@@ -120,7 +120,16 @@
                   mlist, msg, msgdata, repl=False)
     # Do we change the from so the list takes ownership of the email
     if (msgdata.get('from_is_list') or mlist.from_is_list) and not fasttrack:
-        realname, email = parseaddr(msg['from'])
+        # Be as robust as possible here.
+        faddrs = getaddresses(msg.get_all('from', []))
+        if len(faddrs) == 1:
+            realname, email = o_from = faddrs[0]
+        else:
+            # No From: or multiple addresses.  Just punt and take
+            # the get_sender result.
+            realname = ''
+            email = msgdata['original_sender']
+            o_from = (realname, email)
         if not realname:
             if mlist.isMember(email):
                 realname = mlist.getMemberName(email) or email
@@ -128,8 +137,6 @@
                 realname = email
         # Remove domain from realname if it looks like an email address
         realname = re.sub(r'@([^ .]+\.)+[^ .]+$', '---', realname)
-        # Remember the original From: here for adding to Reply-To: below.
-        o_from = parseaddr(msg['from'])
         change_header('From',
                       formataddr(('%s via %s' % (realname, mlist.real_name),
                                  mlist.GetListEmail())),

=== modified file 'NEWS'
--- NEWS	2014-05-06 16:35:47 +0000
+++ NEWS	2014-05-09 19:19:29 +0000
@@ -5,6 +5,13 @@
 
 Here is a history of user visible changes to Mailman.
 
+2.1.19 (xx-xxx-xxxx)
+ 
+  Bug fixes and other patches
+
+    - Handle missing From: header addresses for DMARC mitigation actions.
+      (LP: #1318025)
+
 2.1.18-1 (06-May-2014)
 
   Bug fixes and other patches

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to