------------------------------------------------------------
revno: 1342
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.2
timestamp: Fri 2014-05-09 12:21:00 -0700
message:
  Handle missing From: header addresses for DMARC mitigation actions.
  (LP: #1318025)
modified:
  Mailman/Handlers/CookHeaders.py
  NEWS


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

Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription
=== modified file 'Mailman/Handlers/CookHeaders.py'
--- Mailman/Handlers/CookHeaders.py	2014-05-05 01:54:21 +0000
+++ Mailman/Handlers/CookHeaders.py	2014-05-09 19:21:00 +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:40:56 +0000
+++ NEWS	2014-05-09 19:21:00 +0000
@@ -49,6 +49,13 @@
       archive to emphasize that even if you got to the message from a
       subject, date or author index, previous and next are still by thread.
 
+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