mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
don't automatically create an alias if a user account already exists by that name
In the event the first user is an address that we'd normally create as an alias, we'd generate a loop from the alias to the administrative alias to the first user account (which was the alias again). hopefully fixes #186
This commit is contained in:
parent
f09da719f7
commit
196e42e8b5
@ -312,7 +312,7 @@ def get_required_aliases(env):
|
|||||||
# These are the aliases that must exist.
|
# These are the aliases that must exist.
|
||||||
aliases = set()
|
aliases = set()
|
||||||
|
|
||||||
# The hostmaster aliase is exposed in the DNS SOA for each zone.
|
# The hostmaster alias is exposed in the DNS SOA for each zone.
|
||||||
aliases.add("hostmaster@" + env['PRIMARY_HOSTNAME'])
|
aliases.add("hostmaster@" + env['PRIMARY_HOSTNAME'])
|
||||||
|
|
||||||
# Get a list of domains we serve mail for, except ones for which the only
|
# Get a list of domains we serve mail for, except ones for which the only
|
||||||
@ -344,10 +344,15 @@ def kick(env, mail_result=None):
|
|||||||
|
|
||||||
# Ensure every required alias exists.
|
# Ensure every required alias exists.
|
||||||
|
|
||||||
|
existing_users = get_mail_users(env)
|
||||||
existing_aliases = get_mail_aliases(env)
|
existing_aliases = get_mail_aliases(env)
|
||||||
required_aliases = get_required_aliases(env)
|
required_aliases = get_required_aliases(env)
|
||||||
|
|
||||||
def ensure_admin_alias_exists(source):
|
def ensure_admin_alias_exists(source):
|
||||||
|
# If a user account exists with that address, we're good.
|
||||||
|
if source in existing_users:
|
||||||
|
return
|
||||||
|
|
||||||
# Does this alias exists?
|
# Does this alias exists?
|
||||||
for s, t in existing_aliases:
|
for s, t in existing_aliases:
|
||||||
if s == source:
|
if s == source:
|
||||||
|
Loading…
Reference in New Issue
Block a user