aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2014-05-09 12:19:29 -0700
committerMark Sapiro <mark@msapiro.net>2014-05-09 12:19:29 -0700
commit307a5e4da3877c944be296b278ab59b7c70e24b7 (patch)
tree05a077bf79574ed921a5b6fe5b64253ae98f95d2
parentf3b2c2c7523b5962164672b5b5889c2eb85aca0a (diff)
downloadmailman2-307a5e4da3877c944be296b278ab59b7c70e24b7.tar.gz
mailman2-307a5e4da3877c944be296b278ab59b7c70e24b7.tar.xz
mailman2-307a5e4da3877c944be296b278ab59b7c70e24b7.zip
Handle missing From: header addresses for DMARC mitigation actions.
(LP: #1318025)
-rwxr-xr-xMailman/Handlers/CookHeaders.py13
-rwxr-xr-xNEWS7
2 files changed, 17 insertions, 3 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
index c6f25044..78701850 100755
--- a/Mailman/Handlers/CookHeaders.py
+++ b/Mailman/Handlers/CookHeaders.py
@@ -120,7 +120,16 @@ def process(mlist, msg, msgdata):
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 @@ def process(mlist, msg, msgdata):
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())),
diff --git a/NEWS b/NEWS
index 26d9f9ef..e71f53c5 100755
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,13 @@ Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
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