Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 76b1f6dd by Mark Sapiro at 2020-05-28T11:42:46-07:00 MS Outlook is only violating a SHOULD so don't claim non-compliance. - - - - - 69e48ac6 by Mark Sapiro at 2020-05-28T18:54:55+00:00 Merge branch 'fix_725' into 'master' MS Outlook is only violating a SHOULD so don't claim non-compliance. See merge request mailman/mailman!653 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/handlers/avoid_duplicates.py - src/mailman/handlers/tests/test_avoid_duplicates.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -19,7 +19,7 @@ Bugs and footers. (Closes #701) * RFC 2369 headers are now added to notification messages. (Closes #710) * Bounce probes are now encoded in the correct charset. (Closes #712) -* We now appropriately parse an incorrectly folded Cc: header from MS Outlook. +* We now unfold address containing headers before parsing in avoid_duplicates. (Closes #725) ===================================== src/mailman/handlers/avoid_duplicates.py ===================================== @@ -57,12 +57,13 @@ class AvoidDuplicates: explicit_recips = listaddrs.copy() # Figure out the set of explicit recipients. cc_addresses = {} - # MS Outlook creates a defective message when composing with several - # Cc addresses of the form `real name (dept) <u...@example.com>`, - # Outlook quotes "real name (dept)" and then folds the header between - # `name and (dept)` resulting in a header including the entry - # '"real name\r\n (dept)" <u...@example.com>' which is non-compliant - # and parses incorrectly, so we "unfold" headers here. + # We've seen messages with Cc: headers folded inside a quoted string. + # I.e., a message composed with several Cc addresses of the form + # 'real name (dept) <u...@example.com>', the MUA quotes + # "real name (dept)" and then folds the header between 'name' and + # '(dept)' resulting in a header including the entry + # '"real name\r\n (dept)" <u...@example.com>' which parses incorrectly, + # so we "unfold" headers here. for header in ('to', 'cc', 'resent-to', 'resent-cc'): hdrs_unfolded = [re.sub('[\r\n]', '', value) for value in msg.get_all(header, [])] ===================================== src/mailman/handlers/tests/test_avoid_duplicates.py ===================================== @@ -77,13 +77,14 @@ X-Mailman-Version: X.Y More things to say. """) - def test_bogus_ms_outlook_header_folding(self): - # MS Outlook creates a defective message when composing with several - # Cc addresses of the form `real name (dept) <u...@example.com>`, - # Outlook quotes "real name (dept)" and then folds the header between - # `name and (dept)` resulting in a header including the entry - # '"real name\r\n (dept)" <u...@example.com>' which is non-compliant - # and parses incorrectly. Test our unfolding defense. + def test_bogus_header_folding(self): + # We've seen messages with Cc: headers folded inside a quoted string. + # I.e., a message composed with several Cc addresses of the form + # 'real name (dept) <u...@example.com>', the MUA quotes + # "real name (dept)" and then folds the header between 'name' and + # '(dept)' resulting in a header including the entry + # '"real name\r\n (dept)" <u...@example.com>' which parses incorrectly, + # This tests that we unfold properly. msg = mfs("""\ From: a...@example.com To: a...@example.com View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/056eb0e73720ba1d0259298da6c71dc81453e6eb...69e48ac68eb3a731eecb376b08a7999869a85ba2 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/056eb0e73720ba1d0259298da6c71dc81453e6eb...69e48ac68eb3a731eecb376b08a7999869a85ba2 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org