VMM/domain: RE_DOMAIN: Check Punycode TLDs more precise.
authorPascal Volk <user@localhost.localdomain.org>
Wed, 29 Jan 2014 20:25:09 +0000
changeset 704 ad15e89a93ec
parent 703 58815c004a61
child 705 9149e0249c25
VMM/domain: RE_DOMAIN: Check Punycode TLDs more precise.
VirtualMailManager/domain.py
--- a/VirtualMailManager/domain.py	Mon Jan 27 22:06:13 2014 +0000
+++ b/VirtualMailManager/domain.py	Wed Jan 29 20:25:09 2014 +0000
@@ -25,7 +25,9 @@
 
 
 MAILDIR_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'
-RE_DOMAIN = re.compile(r"^(?:[a-z0-9-]{1,63}\.){1,}[a-z0-9-]{2,}$")
+RE_DOMAIN = re.compile(r"""^(?:[a-z0-9-]{1,63}\.){1,}  # one or more labels
+                            (?:[a-z]{2,}               # a ASCII TLD
+                            |xn--[a-z0-9]{4,})$        # or a ACE TLD""", re.X)
 _ = lambda msg: msg
 cfg_dget = lambda option: None