mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-21 03:02:09 +00:00
Move priprivileged email check after the conversion to unicode so only IDNA serves as input
This commit is contained in:
parent
8fcfcf820c
commit
09374f930a
@ -433,10 +433,10 @@ def add_mail_alias(address, forwards_to, permitted_senders, env, update_if_exist
|
|||||||
for line in forwards_to.split("\n"):
|
for line in forwards_to.split("\n"):
|
||||||
for email in line.split(","):
|
for email in line.split(","):
|
||||||
email = email.strip()
|
email = email.strip()
|
||||||
# Strip any +tag from email alias and check privileges
|
|
||||||
privileged_email = re.sub(r"(?=\+)[^@]*(?=@)",'',email)
|
|
||||||
if email == "": continue
|
if email == "": continue
|
||||||
email = sanitize_idn_email_address(email) # Unicode => IDNA
|
email = sanitize_idn_email_address(email) # Unicode => IDNA
|
||||||
|
# Strip any +tag from email alias and check privileges
|
||||||
|
privileged_email = re.sub(r"(?=\+)[^@]*(?=@)",'',email)
|
||||||
if not validate_email(email):
|
if not validate_email(email):
|
||||||
return ("Invalid receiver email address (%s)." % email, 400)
|
return ("Invalid receiver email address (%s)." % email, 400)
|
||||||
if is_dcv_source and not is_dcv_address(email) and "admin" not in get_mail_user_privileges(privileged_email, env, empty_on_error=True):
|
if is_dcv_source and not is_dcv_address(email) and "admin" not in get_mail_user_privileges(privileged_email, env, empty_on_error=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user