aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xMailman/Handlers/CookHeaders.py26
-rw-r--r--Mailman/Handlers/WrapMessage.py17
-rwxr-xr-xNEWS11
3 files changed, 43 insertions, 11 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
index 83f278b4..9f94bd4a 100755
--- a/Mailman/Handlers/CookHeaders.py
+++ b/Mailman/Handlers/CookHeaders.py
@@ -68,7 +68,7 @@ def change_header(name, value, mlist, msg, msgdata, delete=True, repl=True):
if ((msgdata.get('from_is_list') == 2 or
(msgdata.get('from_is_list') == 0 and mlist.from_is_list == 2)) and
not msgdata.get('_fasttrack')
- ):
+ ) or name.lower() in ('from', 'reply-to'):
msgdata.setdefault('add_header', {})[name] = value
elif repl or not msg.has_key(name):
if delete:
@@ -128,16 +128,8 @@ def process(mlist, msg, msgdata):
realname = email
# Remove domain from realname if it looks like an email address
realname = re.sub(r'@([^ .]+\.)+[^ .]+$', '---', realname)
- replies = getaddresses(msg.get('reply-to', ''))
- reply_addrs = [x[1].lower() for x in replies]
- if reply_addrs:
- if email.lower() not in reply_addrs:
- rt = msg['reply-to'] + ', ' + msg['from']
- else:
- rt = msg['reply-to']
- else:
- rt = msg['from']
- change_header('Reply-To', rt, mlist, msg, msgdata)
+ # 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())),
@@ -145,6 +137,9 @@ def process(mlist, msg, msgdata):
if mlist.from_is_list != 2:
del msg['sender']
#MAS ?? mlist.include_sender_header = 0
+ else:
+ # Use this as a flag
+ o_from = None
# Reply-To: munging. Do not do this if the message is "fast tracked",
# meaning it is internally crafted and delivered to a specific user. BAW:
# Yuck, I really hate this feature but I've caved under the sheer pressure
@@ -171,9 +166,18 @@ def process(mlist, msg, msgdata):
# cases we'll zap the existing field because RFC 2822 says max one is
# allowed.
if not mlist.first_strip_reply_to:
+ # If we Munged the From:, add it to Reply-To: if we're not
+ # stripping it.
+ #MAS ? Should we add it anyway?
+ if o_from:
+ add(o_from)
orig = msg.get_all('reply-to', [])
for pair in getaddresses(orig):
add(pair)
+ # We also need to put the old From: in Reply-To: if reply_goes_to_list
+ # is to the poster even if we're stripping Reply-To:
+ if mlist.reply_goes_to_list == 0 and o_from:
+ add(o_from)
# Set Reply-To: header to point back to this list. Add this last
# because some folks think that some MUAs make it easier to delete
# addresses from the right than from the left.
diff --git a/Mailman/Handlers/WrapMessage.py b/Mailman/Handlers/WrapMessage.py
index de981dd6..d9f4e04a 100644
--- a/Mailman/Handlers/WrapMessage.py
+++ b/Mailman/Handlers/WrapMessage.py
@@ -17,6 +17,9 @@
"""Wrap the message in an outer message/rfc822 part and transfer/add
some headers from the original.
+
+Also, in the case of Munge From, replace the From: and Reply-To: in the
+original message.
"""
import copy
@@ -35,8 +38,22 @@ KEEPERS = ('to',
def process(mlist, msg, msgdata):
+ # This is the negation of we're wrapping because dmarc_moderation_action
+ # is wrap this message or from_is_list applies and is wrap.
if not (msgdata.get('from_is_list') == 2 or
(mlist.from_is_list == 2 and msgdata.get('from_is_list') == 0)):
+ # Now see if we're munging.
+ if msgdata.get('from_is_list') == 1 or (mlist.from_is_list == 1 and
+ msgdata.get('from_is_list') == 0):
+ # Yes.
+ a_h = msgdata.get('add_header')
+ if a_h:
+ if a_h.get('From'):
+ del msg['from']
+ msg['From'] = a_h.get('From')
+ if a_h.get('Reply-To'):
+ del msg['reply-to']
+ msg['Reply-To'] = a_h.get('Reply-To')
return
# There are various headers in msg that we don't want, so we basically
diff --git a/NEWS b/NEWS
index 65447dc7..bef272ac 100755
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,18 @@ Copyright (C) 1998-2013 by the Free Software Foundation, Inc.
Here is a history of user visible changes to Mailman.
+2.1.18 (xx-xxx-xxxx)
+
+ Bug fixes and other patches
+
+ - Fixed the Munge From action to only Munge the From: and/or Reply-To: in
+ the outgoing message and not in archives, digests and messages sent via
+ the usenet gateway. (LP: #1311431)
+
2.1.18rc2 (19-Apr-2014)
+
+ Bug fixes and other patches
+
- The new Utils.IsDMARCProhibited() used collections.defaultdict which
requires Python 2.5. Changed to use a dict and setdefault.