diff options
author | Mark Sapiro <mark@msapiro.net> | 2020-01-16 16:03:34 -0800 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2020-01-16 16:03:34 -0800 |
commit | f82ff472e5ccfa07f99a0eff5e98c5bc5ebf3e9b (patch) | |
tree | 5c62bd7bf0d39394630c8103861313897d07e834 /Mailman/Bouncers/SimpleMatch.py | |
parent | ddcf01000176f61dbf03122096a50d1a6bd8c2a5 (diff) | |
download | mailman2-f82ff472e5ccfa07f99a0eff5e98c5bc5ebf3e9b.tar.gz mailman2-f82ff472e5ccfa07f99a0eff5e98c5bc5ebf3e9b.tar.xz mailman2-f82ff472e5ccfa07f99a0eff5e98c5bc5ebf3e9b.zip |
Fixed SimpleMatch to only return valid addresses.
Diffstat (limited to 'Mailman/Bouncers/SimpleMatch.py')
-rw-r--r-- | Mailman/Bouncers/SimpleMatch.py | 5 |
1 files changed, 4 insertions, 1 deletions
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)] |