Fixed, it will be available in next release of iRedAdmin-Pro. Below is patch if you want to give it a try:
diff -r ef52758f69c6 libs/amavisd/__init__.py
--- a/libs/amavisd/__init__.py Fri Feb 20 13:15:06 2015 +0800
+++ b/libs/amavisd/__init__.py Wed Feb 25 11:49:38 2015 +0800
@@ -28,13 +28,14 @@
# 1 - lookup for @.com
# 0 - lookup for @. (catchall)
MAILADDR_PRIORITIES = {
+ 'ip': 10,
'email': 8,
'wildcard_addr': 6, # r'user@*'. used in iRedAPD plugin `amavisd_wblist`
# as wildcard sender. e.g. 'user@*'
'domain': 5,
'subdomain': 3,
+ 'top_level_domain': 1,
'catchall': 0,
- 'ip': 10,
}
@@ -52,13 +53,14 @@
# a new address format.
if addr.startswith(r'@.'):
if addr == r'@.':
- # catch all
return 'catchall'
else:
- # sub-domain
domain = addr.split(r'@.', 1)[-1]
+
if iredutils.is_domain(domain):
return 'subdomain'
+ elif iredutils.is_tld_domain(domain):
+ return 'top_level_domain'
elif addr.startswith(r'@'):
# entire domain
diff -r ef52758f69c6 libs/iredutils.py
--- a/libs/iredutils.py Fri Feb 20 13:15:06 2015 +0800
+++ b/libs/iredutils.py Wed Feb 25 11:49:38 2015 +0800
@@ -19,7 +19,8 @@
regx_email = r'''[\w\-][\w\-\.\+\=]*@[\w\-][\w\-\.]*\.[a-zA-Z0-9\-]{2,15}'''
# Domain name
-regx_domain = r'''[\w\-][\w\-\.]*\.[a-z0-9\-]{2,15}'''
+regx_domain = r'''[\w\-][\w\-\.]*\.[a-z0-9\-]{2,25}'''
+regx_top_level_domain = r'''[a-z0-9\-]{2,25}'''
# IP address
regx_ipv4 = r'(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})$'
@@ -56,6 +57,16 @@
return False
+def is_tld_domain(s):
+ s = str(s)
+
+ comp_domain = re.compile(regx_top_level_domain + '$', re.IGNORECASE)
+ if comp_domain.match(s):
+ return True
+ else:
+ return False
+
+
# Valid IP address
def is_ipv4(s):
if re.match(regx_ipv4, s):