------------------------------------------------------------
revno: 1439
fixes bug: https://launchpad.net/bugs/1258703
committer: Mark Sapiro <msap...@value.net>
branch nick: 2.1
timestamp: Fri 2013-12-06 17:19:28 -0800
message:
  Fixed email address validation to do a bit better in obscure cases.
modified:
  Mailman/Utils.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Utils.py'
--- Mailman/Utils.py	2011-11-14 00:47:19 +0000
+++ Mailman/Utils.py	2013-12-07 01:19:28 +0000
@@ -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 @@
     # 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 @@
     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
 
 

=== modified file 'NEWS'
--- NEWS	2013-12-02 23:26:58 +0000
+++ NEWS	2013-12-07 01:19:28 +0000
@@ -9,6 +9,9 @@
 
   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)
  

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to