From 38575a69e772c1f35089b780c8317d9e8c4adf5f Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Wed, 16 Nov 2016 15:27:10 -0800 Subject: Enhanced the fix for race conditions in MailList().Load(). --- Mailman/MailList.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Mailman') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 99cbbd2f..d1dc17a4 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -634,6 +634,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, if e.errno <> errno.ENOENT: raise # The file doesn't exist yet return None, e + now = int(time.time()) try: try: dict = loadfunc(fp) @@ -645,8 +646,9 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, finally: fp.close() # Update the timestamp. We use current time here rather than mtime - # so the test above might succeed the next time. - self.__timestamp = int(time.time()) + # so the test above might succeed the next time. And we get the time + # before unpickling in case it takes more than a second. (LP: #266464) + self.__timestamp = now return dict, None def Load(self, check_version=True): -- cgit v1.2.3 From 6e90f0855eea0c2f23deefbf9f478de478619933 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Wed, 23 Nov 2016 13:27:00 -0800 Subject: Fixed UnicodeError in sending digests following changing list's preferred_language. --- Mailman/Handlers/ToDigest.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Mailman') diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 2027a46c..02965f82 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2013 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -67,6 +67,17 @@ except NameError: False = 0 + +def to_cset_out(text, lcset): + # Convert text from unicode or lcset to output cset. + ocset = Charset(lcset).get_output_charset() or lcset + if isinstance(text, unicode): + return text.encode(ocset, errors='replace') + else: + return text.decode(lcset, errors='replace').encode(ocset, + errors='replace') + + def process(mlist, msg, msgdata): # Short circuit non-digestable lists. @@ -299,7 +310,7 @@ def send_i18n_digests(mlist, mboxfp): if msgcount == 0: # Why did we even get here? return - toctext = toc.getvalue() + toctext = to_cset_out(toc.getvalue(), lcset) # MIME tocpart = MIMEText(toctext, _charset=lcset) tocpart['Content-Description']= _("Today's Topics (%(msgcount)d messages)") @@ -412,7 +423,7 @@ def send_i18n_digests(mlist, mboxfp): listname=mlist.internal_name(), isdigest=True) # RFC 1153 - rfc1153msg.set_payload(plainmsg.getvalue(), lcset) + rfc1153msg.set_payload(to_cset_out(plainmsg.getvalue(), lcset), lcset) virginq.enqueue(rfc1153msg, recips=plainrecips, listname=mlist.internal_name(), -- cgit v1.2.3 From 564f98f744356c544c386878a0a231393beb5229 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 24 Nov 2016 08:24:14 -0800 Subject: Properly RFC 2047 encode the display name in DMARC munged From:. --- Mailman/Handlers/CookHeaders.py | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'Mailman') diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index 59eb67b7..84d3032d 100755 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -29,6 +29,7 @@ from email.Header import Header, decode_header, make_header from email.Utils import parseaddr, formataddr, getaddresses from email.Errors import HeaderParseError +from Mailman import i18n from Mailman import mm_cfg from Mailman import Utils from Mailman.i18n import _ @@ -154,12 +155,37 @@ def process(mlist, msg, msgdata): realname = email # Remove domain from realname if it looks like an email address realname = re.sub(r'@([^ .]+\.)+[^ .]+$', '---', realname) - # RFC 2047 encode realname if necessary. - realname = str(uheader(mlist, realname)) - lrn = mlist.real_name + # Make a display name and RFC 2047 encode it if necessary. This is + # difficult and kludgy. If the realname came from From: it should be + # ascii or RFC 2047 encoded. If it came from the list, it should be + # in the charset of the list's preferred language or possibly unicode. + # if it's from the email address, it should be ascii. In any case, + # make it a unicode. + if isinstance(realname, unicode): + urn = realname + else: + rn, cs = ch_oneline(realname) + urn = unicode(rn, cs, errors='replace') + # likewise, the list's real_name which should be ascii, but use the + # charset of the list's preferred_language which should be a superset. + lcs = Utils.GetCharSet(mlist.preferred_language) + ulrn = unicode(mlist.real_name, lcs, errors='replace') + # get translated 'via' with dummy replacements + realname = '%(realname)s' + lrn = '%(lrn)s' + # We want the i18n context to be the list's preferred_language. It + # could be the poster's. + otrans = i18n.get_translation() + i18n.set_language(mlist.preferred_language) + via = _('%(realname)s via %(lrn)s') + i18n.set_translation(otrans) + uvia = unicode(via, lcs, errors='replace') + # Replace the dummy replacements. + uvia = re.sub(u'%\(lrn\)s', ulrn, re.sub(u'%\(realname\)s', urn, uvia)) + # And get an RFC 2047 encoded header string. + dn = str(Header(uvia, lcs)) change_header('From', - formataddr((_('%(realname)s via %(lrn)s'), - mlist.GetListEmail())), + formataddr((dn, mlist.GetListEmail())), mlist, msg, msgdata) else: # Use this as a flag @@ -400,7 +426,12 @@ def prefix_subject(mlist, msg, msgdata): # At this point, subject may become null if someone post mail with # subject: [subject prefix] if subject.strip() == '': + # We want the i18n context to be the list's preferred_language. It + # could be the poster's. + otrans = i18n.get_translation() + i18n.set_language(mlist.preferred_language) subject = _('(no subject)') + i18n.set_translation(otrans) cset = Utils.GetCharSet(mlist.preferred_language) subject = unicode(subject, cset) # and substitute %d in prefix with post_id -- cgit v1.2.3 From 62c260510d4918841d320d1dfc760238e87b8af6 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 29 Nov 2016 15:40:04 -0800 Subject: Removed CleanseDKIM from OWNER_PIPELINE because of DMARC issues on anonymous lists. --- Mailman/Defaults.py.in | 1 - 1 file changed, 1 deletion(-) (limited to 'Mailman') diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 9ecdbe62..fb2b26b6 100755 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -666,7 +666,6 @@ GLOBAL_PIPELINE = [ OWNER_PIPELINE = [ 'SpamDetect', 'Replybot', - 'CleanseDKIM', 'OwnerRecips', 'ToOutgoing', ] -- cgit v1.2.3