A workaround for treating long address splitted into lines
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman |
New
|
Undecided
|
Unassigned |
Bug Description
---Summary:---
Following is a workaround for a problem when
processing very long email address field that is
splitted into two or more lines.
I tested it on Mailman 2.1.8.
Please evaluate this patch and feedback to the latest
build.
I appreciate if this is a duplicate of already reported
one.
---Problem Description:---
The mail address parser program
(pythonlib/
field is splitted into two or more lines by using
continuations(eg. "\r\n " or "\r\n\t").
For example, following "Cc:" field can be splitted into
lines when the mail is sent to the server.
Cc:
=?ISO-2022-
=?ISO-
=?ISO-
=?ISO-
<email address hidden>
The main problem is there are no actual email address
at line 1 and 3.
Current code in _parseaddr.py expects there is at least
one valid email address in a line. So what will happen?
See below. When posting the mail to members, two
addresses are newly made, with a default domain name
(@mailman.
Cc: =?ISO-2022-
=?ISO-
=?ISO-
=?ISO-
<email address hidden>
---Patch---
I made a workaroud patch by adding a darty code into
getphraselist() method.
-------
def getphraselist(
"""Parse a sequence of RFC 2822 phrases.
A phrase is a sequence of words, which are in
turn either RFC 2822
atoms or quoted-strings. Phrases are
canonicalized by squeezing all
runs of continuous whitespace into one space.
"""
plist = []
while self.pos < len(self.field):
if self.field[
elif self.field[
elif self.field[
+ elif (self.pos + 4) < len(self.field) and
self.field[
in '\n' and self.field[
+ self.pos += 3
+ elif (self.pos + 4) < len(self.field) and
self.field[
in '\n' and self.field[
+ self.pos += 3
+ elif (self.pos + 4) < len(self.field) and
self.field[
in '\t':
+ self.pos += 2
+ elif (self.pos + 4) < len(self.field) and
self.field[
in ' ':
+ self.pos += 2
+ elif (self.pos + 4) < len(self.field) and
self.field[
in '\t':
+ self.pos += 2
elif self.field[
else:
return plist
-------