diff options
author | Mark Sapiro <mark@msapiro.net> | 2009-08-01 16:15:35 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2009-08-01 16:15:35 -0700 |
commit | e469619d91f4f15574e233a2cfa4b07c8d7f36d6 (patch) | |
tree | 68ed37abcbd7b340a50cdd045c66c316119606fb /Mailman/Handlers | |
parent | fdfee4b34c818c410dd586e86ab1dad99c2a5f4c (diff) | |
download | mailman2-e469619d91f4f15574e233a2cfa4b07c8d7f36d6.tar.gz mailman2-e469619d91f4f15574e233a2cfa4b07c8d7f36d6.tar.xz mailman2-e469619d91f4f15574e233a2cfa4b07c8d7f36d6.zip |
Mailman no longer folds long sub-part headers in multipart messages.
In addition, Mailman no longer escapes From_ lines in the body of
messages sent to regular list members, although MTA's may do it anyway.
This is to avoid breaking signatures per Bug #265967. Changes include
- Message.py, added a Generator class to avoid header folding and an
as_string() method wirth a mangle_from_ argument.
- Mailbox.py, uses new Message.Generator class.
- SMTPDirect.py, uses as_string(mangle_from_=False) to flatten message.
- Scrubber.py, removed unused ScrubberGenerator class.
Diffstat (limited to '')
-rw-r--r-- | Mailman/Handlers/SMTPDirect.py | 6 | ||||
-rw-r--r-- | Mailman/Handlers/Scrubber.py | 21 |
2 files changed, 4 insertions, 23 deletions
diff --git a/Mailman/Handlers/SMTPDirect.py b/Mailman/Handlers/SMTPDirect.py index 72b587e9..8e3c7d73 100644 --- a/Mailman/Handlers/SMTPDirect.py +++ b/Mailman/Handlers/SMTPDirect.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2009 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 @@ -360,7 +360,9 @@ def bulkdeliver(mlist, msg, msgdata, envsender, failures, conn): msg['Sender'] = envsender msg['Errors-To'] = envsender # Get the plain, flattened text of the message, sans unixfrom - msgtext = msg.as_string() + # using our as_string() method to not mangle From_ and not fold + # sub-part headers possibly breaking signatures. + msgtext = msg.as_string(mangle_from_=False) refused = {} recips = msgdata['recips'] msgid = msg['message-id'] diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index a990d721..b39f36d2 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -90,27 +90,6 @@ def guess_extension(ctype, ext): return all and all[0] - -# We're using a subclass of the standard Generator because we want to suppress -# headers in the subparts of multiparts. We use a hack -- the ctor argument -# skipheaders to accomplish this. It's set to true for the outer Message -# object, but false for all internal objects. We recognize that -# sub-Generators will get created passing only mangle_from_ and maxheaderlen -# to the ctors. -# -# This isn't perfect because we still get stuff like the multipart boundaries, -# but see below for how we corrupt that to our nefarious goals. -class ScrubberGenerator(Generator): - def __init__(self, outfp, mangle_from_=True, - maxheaderlen=78, skipheaders=True): - Generator.__init__(self, outfp, mangle_from_=False) - self.__skipheaders = skipheaders - - def _write_headers(self, msg): - if not self.__skipheaders: - Generator._write_headers(self, msg) - - def safe_strftime(fmt, t): try: return time.strftime(fmt, t) |