From a900d16b53b0e723d52a83c99e296c286402adf0 Mon Sep 17 00:00:00 2001 From: ibu radempa Date: Fri, 4 Sep 2020 18:10:20 +0200 Subject: [PATCH] Change data models for aliases in mail_system. REQUIRES MANUAL CHANGES TO DATA! When matching an alias do no more match it against the value of field alias in the aliases table, but match it against the concatenation of this value with '@' and the value of the name field in the domains table, where the row is obtained by matching aliases.alias_domain_id and domains.id. --- mail_system/templates/postfix/aliases.cf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_system/templates/postfix/aliases.cf b/mail_system/templates/postfix/aliases.cf index d5f1e69..e423af7 100644 --- a/mail_system/templates/postfix/aliases.cf +++ b/mail_system/templates/postfix/aliases.cf @@ -7,4 +7,4 @@ user = {{ mailserver.postgresql.username }} password = {{ mailserver.postgresql.password }} dbname = {{ mailserver.postgresql.dbname }} hosts = {{ mailserver.postgresql.host }} -query = SELECT unnest(forwardings) FROM aliases WHERE alias = '%s' +query = SELECT unnest(a.forwardings) FROM aliases a JOIN domains d ON a.alias_domain_id=d.id WHERE a.alias || '@' || d.name = '%s'