~mailman-coders/mailman/2.1

« back to all changes in this revision

Viewing changes to Mailman/Bouncers/SimpleMatch.py

  • Committer: Mark Sapiro
  • Date: 2020-01-17 00:03:34 UTC
  • Revision ID: mark@msapiro.net-20200117000334-8s3tx7yimpxt5oqj
Fixed SimpleMatch to only return valid addresses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
def _c(pattern):
26
26
    return re.compile(pattern, re.IGNORECASE)
27
27
 
 
28
# Pattern to match any valid email address and not much more.
 
29
VALID = _c(r'[\x21-\x3d\x3f\x41-\x7e]+@[a-z0-9._]+')
 
30
 
28
31
# This is a list of tuples of the form
29
32
#
30
33
#     (start cre, end cre, address cre)
227
230
                    break
228
231
        if addrs:
229
232
            break
230
 
    return addrs.keys()
 
233
    return [x for x in addrs.keys() if VALID.match(x)]