diff options
author | Mark Sapiro <mark@msapiro.net> | 2008-05-07 20:46:19 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2008-05-07 20:46:19 -0700 |
commit | acca1a3aae7c167aed83059340e3ce3c8c09ad3c (patch) | |
tree | c695e2ae27acf693fea69f28532fb8e9c6b11147 /Mailman/Utils.py | |
parent | eee0141340a74acc97fac4a4238f7305d1dee4b6 (diff) | |
download | mailman2-acca1a3aae7c167aed83059340e3ce3c8c09ad3c.tar.gz mailman2-acca1a3aae7c167aed83059340e3ce3c8c09ad3c.tar.xz mailman2-acca1a3aae7c167aed83059340e3ce3c8c09ad3c.zip |
Changed Utils.ValidateEmail to not allow specials (particularly ':')
in unquoted local parts (SF bug # 1956393).
Diffstat (limited to '')
-rw-r--r-- | Mailman/Utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 7b2cf439..cd9faa41 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2007 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -203,6 +203,9 @@ def LCDomain(addr): # TBD: what other characters should be disallowed? _badchars = re.compile(r'[][()<>|;^,\000-\037\177-\377]') +# characters in addition to _badchars which are not allowed in +# unquoted local parts. +_specials = re.compile(r'[:\\"]') def ValidateEmail(s): """Verify that an email address isn't grossly evil.""" @@ -212,11 +215,15 @@ def ValidateEmail(s): if _badchars.search(s) or s[0] == '-': raise Errors.MMHostileAddress, s user, domain_parts = ParseEmail(s) - # This means local, unqualified addresses, are no allowed + # This means local, unqualified addresses, are not allowed if not domain_parts: raise Errors.MMBadEmailError, s if len(domain_parts) < 2: raise Errors.MMBadEmailError, s + if not (user.startswith('"') and user.endswith('"')): + # local part is not quoted so it can't contain specials + if _specials.search(user): + raise Errors.MMBadEmailError, s |