------------------------------------------------------------
revno: 1298
committer: Mark Sapiro <msap...@value.net>
branch nick: 2.2
timestamp: Fri 2013-12-06 17:23:54 -0800
message:
  Fixed email address validation to do a bit better in obscure cases.
modified:
  Mailman/Utils.py
  NEWS


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

Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription
=== modified file 'Mailman/Utils.py'
--- Mailman/Utils.py	2011-11-14 00:50:34 +0000
+++ Mailman/Utils.py	2013-12-07 01:23:54 +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
@@ -224,7 +224,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
@@ -233,8 +233,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:28:18 +0000
+++ NEWS	2013-12-07 01:23:54 +0000
@@ -53,6 +53,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