Fixed. patch attached. If you're not familiar with patch, contact us to get a patched version, then upgrade it by following the upgrade tutorial:
http://www.iredmail.org/docs/migrate.or … admin.html
diff -r 3ee97e7e252d libs/sqllib/alias.py
--- a/libs/sqllib/alias.py Wed Jul 12 15:33:51 2017 +0800
+++ b/libs/sqllib/alias.py Wed Jul 12 16:45:25 2017 +0800
@@ -377,14 +377,17 @@
_members = [str(v).strip().lower() for v in form.get('members', '').splitlines()]
_members = list(set([iredutils.strip_mail_ext_address(v) for v in _members if iredutils.is_email(v)]))
_moderators = [str(v).strip().lower() for v in form.get('moderators', '').splitlines()]
- _moderators = list(set([iredutils.strip_mail_ext_address(v) for v in _moderators if iredutils.is_email(v)]))
+ _moderators = list(set([iredutils.strip_mail_ext_address(v)
+ for v in _moderators
+ if iredutils.is_email(v) or v.startswith('*@')]))
+ _moderators_wildcard = [v for v in _moderators if iredutils.is_domain(v.split('@', 1)[-1])]
# Remove non-exist accounts in same domain.
# Get members & moderators which in same domain.
_members_in_domain = [i for i in _members if i.endswith('@' + domain)]
_members_not_in_domain = [i for i in _members if not i.endswith('@' + domain)]
- _moderators_in_domain = [i for i in _moderators if i.endswith('@' + domain)]
- _moderators_not_in_domain = [i for i in _moderators if not i.endswith('@' + domain)]
+ _moderators_in_domain = [i for i in _moderators if i.endswith('@' + domain) and i not in _moderators_wildcard]
+ _moderators_not_in_domain = [i for i in _moderators if not (i.endswith('@' + domain) or i in _moderators_wildcard)]
# Verify internal users
addresses_in_domain = []
@@ -434,7 +437,7 @@
conn.multiple_insert('forwardings', values=v)
# Add moderators by inserting new records
- _all_moderators = moderators_in_domain + _moderators_not_in_domain
+ _all_moderators = moderators_in_domain + _moderators_not_in_domain + _moderators_wildcard
if _all_moderators:
v = []
for _moderator in _all_moderators:
@@ -503,7 +506,7 @@
what='moderator',
where='address=$mail')
- _addresses = [str(i.moderator).lower() for i in qr if iredutils.is_email(i.moderator)]
+ _addresses = [str(i.moderator).lower() for i in qr if iredutils.is_email(i.moderator) or i.moderator.startswith('*@')]
_addresses.sort()
return (True, _addresses)