From f82ff472e5ccfa07f99a0eff5e98c5bc5ebf3e9b Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 16 Jan 2020 16:03:34 -0800 Subject: Fixed SimpleMatch to only return valid addresses. --- Mailman/Bouncers/SimpleMatch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Mailman/Bouncers/SimpleMatch.py') diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index ca648f65..fd833a40 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -25,6 +25,9 @@ import email.Iterators def _c(pattern): return re.compile(pattern, re.IGNORECASE) +# Pattern to match any valid email address and not much more. +VALID = _c(r'[\x21-\x3d\x3f\x41-\x7e]+@[a-z0-9._]+') + # This is a list of tuples of the form # # (start cre, end cre, address cre) @@ -227,4 +230,4 @@ def process(msg, patterns=None): break if addrs: break - return addrs.keys() + return [x for x in addrs.keys() if VALID.match(x)] -- cgit v1.2.3 From efac0c287e739e4595faf6bcbea591c635302518 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 16 Jan 2020 19:25:09 -0800 Subject: Valid address pattern needs to consume the whole string. --- Mailman/Bouncers/SimpleMatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Mailman/Bouncers/SimpleMatch.py') diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index fd833a40..1c573e02 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -26,7 +26,7 @@ def _c(pattern): return re.compile(pattern, re.IGNORECASE) # Pattern to match any valid email address and not much more. -VALID = _c(r'[\x21-\x3d\x3f\x41-\x7e]+@[a-z0-9._]+') +VALID = _c(r'^[\x21-\x3d\x3f\x41-\x7e]+@[a-z0-9._]+$') # This is a list of tuples of the form # -- cgit v1.2.3 From 8ec4dad9822f390a3e4a1fe7451ccc97f5a3d6de Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sat, 25 Apr 2020 20:14:40 -0700 Subject: Updates to bounce recognition. --- Mailman/Bouncers/SimpleMatch.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Mailman/Bouncers/SimpleMatch.py') diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index 1c573e02..6de9a858 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -195,6 +195,10 @@ PATTERNS = [ (_c('Message could not be delivered to some recipients.'), _c('Message headers follow'), _c('Recipient: \[SMTP:(?P[^\s@]+@[^\s@]+)\]')), + # This one is from Yahoo but dosen't fit the yahoo recognizer format + (_c(r'wasn\'t able to deliver the following message'), + _c(r'---Below this line is a copy of the message.'), + _c(r'To: (?P[^\s@]+@[^\s@]+)')), # Next one goes here... ] -- cgit v1.2.3