From d03507def644416adf753098173220be6f75c137 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Wed, 28 Nov 2018 12:03:48 -0800 Subject: Added recognition for non-compliant opensmtpd DSN Action: error. --- Mailman/Bouncers/DSN.py | 3 ++- NEWS | 3 +++ tests/bounces/dsn_18.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/test_bounces.py | 1 + 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/bounces/dsn_18.txt diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index 701617db..b316c696 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -56,7 +56,8 @@ def check(msg): # Some MTAs have been observed that put comments on the action. if action.startswith('delayed'): return Stop - if not action.startswith('fail'): + # opensmtpd uses non-compliant Action: error. + if not (action.startswith('fail') or action.startswith('error')): # Some non-permanent failure, so ignore this block continue params = [] diff --git a/NEWS b/NEWS index 6efcfd0e..da907746 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,9 @@ Here is a history of user visible changes to Mailman. - Scrubbed application/octet-stream MIME parts will now be given a .bin extension instead of .obj. + - Added bounce recognition for a non-compliant opensmtpd DSN with + Action: error. (LP: #1805137) + 2.1.29 (24-Jul-2018) Bug Fixes diff --git a/tests/bounces/dsn_18.txt b/tests/bounces/dsn_18.txt new file mode 100644 index 00000000..f2988895 --- /dev/null +++ b/tests/bounces/dsn_18.txt @@ -0,0 +1,52 @@ +Return-Path: <> +X-Original-To: list.name-bounces@domain.replaced +Delivered-To: list.name-bounces@domain.replaced +Received: from mx.domain.replaced (mx.domain.replaced [177.XXX.XXX.XXX]) + by mailhost.domain.replaced (Postfix) with ESMTP id 6D6C71E8A3 + for ; Thu, 22 Nov 2018 17:56:08 -0200 (BRST) +Received: from mx.domain.replaced (mx.domain.replaced [local]) + by mx.domain.replaced (OpenSMTPD) with ESMTPA id cce9bd49 + for ; + Thu, 22 Nov 2018 17:56:08 -0200 (-02) +Subject: Delivery status notification: error +From: Mailer Daemon +To: list.name-bounces@domain.replaced +Date: Thu, 22 Nov 2018 17:56:08 -0200 (-02) +MIME-Version: 1.0 +Content-Type: multipart/mixed;boundary="9950749020440539406/mx.domain.replaced" +Message-ID: + +This is a MIME-encapsulated message. + +--9950749020440539406/mx.domain.replaced +Content-Description: Notification +Content-Type: text/plain; charset=us-ascii + + Hi! + + This is the MAILER-DAEMON, please DO NOT REPLY to this email. + + An error has occurred while attempting to deliver a message for + the following list of recipients: + +email@replaced.net: Domain does not exist + + Below is a copy of the original message: + +--9950749020440539406/mx.domain.replaced +Content-Description: Delivery Report +Content-Type: message/delivery-status + +Reporting-MTA: dns; mx.domain.replaced + +Final-Recipient: rfc822; email@replaced.net +Action: error +Status: 5.0.0 + +--9950749020440539406/mx.domain.replaced +Content-Description: Message headers +Content-Type: text/rfc822-headers + +[ORIGINAL MESSAGE] + +--9950749020440539406/mx.domain.replaced-- diff --git a/tests/test_bounces.py b/tests/test_bounces.py index e9bcff17..2f814428 100644 --- a/tests/test_bounces.py +++ b/tests/test_bounces.py @@ -122,6 +122,7 @@ class BounceTest(unittest.TestCase): ('DSN', 'dsn_15.txt', ['userx@example.com']), ('DSN', 'dsn_16.txt', ['userx@example.com']), ('DSN', 'dsn_17.txt', Stop), + ('DSN', 'dsn_18.txt', ['email@replaced.net']), # Microsoft Exchange ('Exchange', 'microsoft_01.txt', ['userx@example.COM']), ('Exchange', 'microsoft_02.txt', ['userx@example.COM']), -- cgit v1.2.3