From 2c5c290f22d726d18e2b8b7b2def2b0af0ab1406 Mon Sep 17 00:00:00 2001 From: Steven Mondji-Lerider Date: Fri, 31 Jan 2014 14:33:47 +0000 Subject: [PATCH] Correcting upgrade script to manage catch all aliases correctly --- install/upgrades/3.0.0~1.sql | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/install/upgrades/3.0.0~1.sql b/install/upgrades/3.0.0~1.sql index 5f1e541d..a39d6d31 100644 --- a/install/upgrades/3.0.0~1.sql +++ b/install/upgrades/3.0.0~1.sql @@ -361,6 +361,19 @@ update mail_domain, domaines, mail_users and mail_domain.pop = 1; -- Here we should have inserted all local managed mailboxes and their aliases. +-- Insert catchall alias only adresses. +insert into address (domain_id, address, type, password) + select domaines.id as domain_id, + substring_index(mail_domain.mail, '@', 1) as address, + 'catchall' as type, + '' as password + from domaines + join mail_domain + on domaines.domaine = substring_index(mail_domain.mail, '@', -1) + where mail_domain.mail like '@%' + and mail_domain.type = 0 + and mail_domain.pop = 0 + and substring_index(mail_domain.mail, '@', 1) =''; -- Insert alias only adresses. insert into address (domain_id, address, type, password) @@ -373,7 +386,8 @@ insert into address (domain_id, address, type, password) on domaines.domaine = substring_index(mail_domain.mail, '@', -1) where mail_domain.mail like '%@%' and mail_domain.type = 0 - and mail_domain.pop = 0; + and mail_domain.pop = 0 + and substring_index(mail_domain.mail, '@', 1) != ''; insert into recipient (address_id, recipients) select address.id as address_id, @@ -399,6 +413,9 @@ update mail_domain, domaines and mail_domain.mail like '%@%' and mail_domain.type = 0 and mail_domain.pop = 0; +~ + + -- Insert procmail managed addresses. -- Note: those addresses should be treated as local managed adresses.