diff options
author | Mark Sapiro <msapiro@value.net> | 2013-12-06 17:19:28 -0800 |
---|---|---|
committer | Mark Sapiro <msapiro@value.net> | 2013-12-06 17:19:28 -0800 |
commit | 5cd4000e9f8157e13bba8ff146249aed50a7cb02 (patch) | |
tree | b2bb5d8d259144086b5382cdb7cd4170ec348c00 | |
parent | d56abb9d7a556a8703cd7ea46a39f72b31d5f082 (diff) | |
download | mailman2-5cd4000e9f8157e13bba8ff146249aed50a7cb02.tar.gz mailman2-5cd4000e9f8157e13bba8ff146249aed50a7cb02.tar.xz mailman2-5cd4000e9f8157e13bba8ff146249aed50a7cb02.zip |
Fixed email address validation to do a bit better in obscure cases.
Diffstat (limited to '')
-rw-r--r-- | Mailman/Utils.py | 7 | ||||
-rwxr-xr-x | NEWS | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 93e1fba1..0a20423a 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2013 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 @@ -223,7 +223,7 @@ def ValidateEmail(s): # Pretty minimal, cheesy check. We could do better... if not s or s.count(' ') > 0: raise Errors.MMBadEmailError - if _badchars.search(s) or s[0] == '-': + if _badchars.search(s): raise Errors.MMHostileAddress, s user, domain_parts = ParseEmail(s) # This means local, unqualified addresses, are not allowed @@ -232,8 +232,9 @@ def ValidateEmail(s): if len(domain_parts) < 2: raise Errors.MMBadEmailError, s # domain parts may only contain ascii letters, digits and hyphen + # and must not begin with hyphen. for p in domain_parts: - if len(_valid_domain.sub('', p)) > 0: + if len(p) == 0 or p[0] == '-' or len(_valid_domain.sub('', p)) > 0: raise Errors.MMHostileAddress, s @@ -9,6 +9,9 @@ Here is a history of user visible changes to Mailman. Bug Fixes and other patches + - Fixed email address validation to do a bit better in obscure cases. + (LP: #1258703) + - Fixed a bug which caused some authentication cookies to expire too soon if AUTHENTICATION_COOKIE_LIFETIME is non-zero. (LP: #1257112) |