[ mailman-Patches-1455262 ] A workaround for treating long address splitted into lines

Patches item #1455262, was opened at 2006-03-21 19:12 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300103&aid=1455262&group_id=103 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: internationalization Group: Mailman 2.1 Status: Open Resolution: None Priority: 5 Submitted By: Naoki Fukuta (naoki-fukuta) Assigned to: Nobody/Anonymous (nobody) Summary: A workaround for treating long address splitted into lines Initial Comment: ---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/email/_parseaddr.py) has a problem when the 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-JP?B?IktCU0UbJEI4JjVmMnEbKEIgGyRCNDQ7dkNEGyhC?= =?ISO-2022-JP?B?Ig==?= <fukutax@example.org>, =?ISO-2022-JP?B?IhskQkVFO1I+cEpzREw/LjNYMnEbKEIgGyRCOCY1ZhsoQg==?= =?ISO-2022-JP?B?GyRCMnFIL0k9Pz05fiU3JTklRiVgGyhCIg==?= <fukutax@example2.org> 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.example3.org). Cc: =?ISO-2022-JP?B?Ig==?= <fukutax@example.org>, =?ISO-2022-JP?B?IktCU0UbJEI4JjVmMnEbKEIgGyRCNDQ7dkNEGyhC?=@mailman.example3.org, =?ISO-2022-JP?B?IhskQkVFO1I+cEpzREw/LjNYMnEbKEIgGyRCOCY1ZhsoQg==?=@mailman.example3.org, =?ISO-2022-JP?B?GyRCMnFIL0k9Pz05fiU3JTklRiVgGyhCIg==?= <fukutax@example2.org> ---Patch--- I made a workaroud patch by adding a darty code into getphraselist() method. ---------------------------------------------------- def getphraselist(self): """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[self.pos] in self.LWS: self.pos += 1 elif self.field[self.pos] == '"': plist.append(self.getquote()) elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) + elif (self.pos + 4) < len(self.field) and self.field[self.pos] in '\r' and self.field[self.pos+1] in '\n' and self.field[self.pos+2] in '\t': + self.pos += 3 + elif (self.pos + 4) < len(self.field) and self.field[self.pos] in '\r' and self.field[self.pos+1] in '\n' and self.field[self.pos+2] in ' ': + self.pos += 3 + elif (self.pos + 4) < len(self.field) and self.field[self.pos] in '\n' and self.field[self.pos+1] in '\t': + self.pos += 2 + elif (self.pos + 4) < len(self.field) and self.field[self.pos] in '\n' and self.field[self.pos+1] in ' ': + self.pos += 2 + elif (self.pos + 4) < len(self.field) and self.field[self.pos] in '\r' and self.field[self.pos+1] in '\t': + self.pos += 2 elif self.field[self.pos] in self.phraseends: break else: plist.append(self.getatom(self.phraseends)) return plist ---------------------------------------- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300103&aid=1455262&group_id=103
participants (1)
-
SourceForge.net