------------------------------------------------------------
revno: 1323
committer: Mark Sapiro <[email protected]>
branch nick: 2.2
timestamp: Wed 2014-04-23 20:32:05 -0700
message:
Fixed the Munge From action to not actually Munge the From: or Reply-To:
until after the message has been sent to the archive, digest and usenet
gateway.
modified:
Mailman/Handlers/CookHeaders.py
Mailman/Handlers/WrapMessage.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-04-15 20:55:52 +0000
+++ Mailman/Handlers/CookHeaders.py 2014-04-24 03:32:05 +0000
@@ -68,7 +68,7 @@
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 @@
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 @@
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 @@
# 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.
=== modified file 'Mailman/Handlers/WrapMessage.py'
--- Mailman/Handlers/WrapMessage.py 2014-04-15 20:55:52 +0000
+++ Mailman/Handlers/WrapMessage.py 2014-04-24 03:32:05 +0000
@@ -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 @@
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
=== modified file 'NEWS'
--- NEWS 2014-04-16 21:45:55 +0000
+++ NEWS 2014-04-24 03:32:05 +0000
@@ -51,6 +51,21 @@
2.1.18 (xx-xxx-xxxx)
+ Bug fixes and other patches
+
+ - Fixed the Munge From action to not actually Munge the From: or Reply-To:
+ until after the message has been sent to the archive, digest and 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.
+
+2.1.18rc1 (18-Apr-2014)
+
Dependencies
- There is a new dependency associated with the new Privacy options ->
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org