From 196e42e8b5c883d0b7c806378999343f0130ce17 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 9 Sep 2014 11:41:44 +0000 Subject: [PATCH] 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 --- management/mailconfig.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/management/mailconfig.py b/management/mailconfig.py index 1eba302e..e3128f39 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -312,7 +312,7 @@ def get_required_aliases(env): # These are the aliases that must exist. 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']) # 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. + existing_users = get_mail_users(env) existing_aliases = get_mail_aliases(env) required_aliases = get_required_aliases(env) 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? for s, t in existing_aliases: if s == source: