diff --git a/.gitattributes b/.gitattributes index 929ffe3a..c15ce12f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -514,6 +514,7 @@ install/upgrades/1.0.1.php -text install/upgrades/1.0.3.sql -text install/upgrades/1.0.sql -text install/upgrades/1.1.php -text +install/upgrades/1.1.sh -text install/upgrades/1.1.sql -text install/upgrades/README -text lang/README -text diff --git a/install/alternc.install b/install/alternc.install index ef908ca5..d64fec14 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -120,6 +120,7 @@ fi # Prepare template expansions # +chown :alterncpanel /etc/alternc/local.sh . /etc/alternc/local.sh # Check ACL diff --git a/install/upgrades/1.1.sh b/install/upgrades/1.1.sh new file mode 100644 index 00000000..0ff23efd --- /dev/null +++ b/install/upgrades/1.1.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +CONFIG_FILE="/etc/alternc/local.sh" + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +umask 022 + +if [ ! -r "$CONFIG_FILE" ]; then + echo "Can't access $CONFIG_FILE." + exit 1 +fi + +if [ `id -u` -ne 0 ]; then + echo "fixperms.sh must be launched as root" + exit 1 +fi + +fix_mail() { + read LOGIN GID || true + while [ "$LOGIN" ]; do + INITIALE=`echo $LOGIN |cut -c1` + REP="$ALTERNC_LOC/mail/$INITIALE/$LOGIN/" + chown --recursive $GID:vmail "$REP" +} + +query="select user,userdb_gid from dovecot_view" +mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fix_mail + + + + diff --git a/install/upgrades/1.1.sql b/install/upgrades/1.1.sql index bad7cf66..b284ae0c 100644 --- a/install/upgrades/1.1.sql +++ b/install/upgrades/1.1.sql @@ -151,41 +151,6 @@ CREATE TABLE IF NOT EXISTS `cron` ( KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Structure de la vue `dovecot_view` --- - -CREATE OR REPLACE VIEW `dovecot_view` AS -SELECT concat(`address`.`address`,'@',`domaines`.`domaine`) AS `user`, -concat('*:storage=',cast(`mailbox`.`quota` as char charset latin1),'M') AS `userdb_quota_rule`, -`address`.`password` AS `password`, -`mailbox`.`path` AS `userdb_home`, -`domaines`.`compte` AS `userdb_uid`, -`domaines`.`compte` AS `userdb_gid`, -`mailbox`.`bytes` AS `quota_dovecot`, -`mailbox`.`messages` AS `nb_messages` -from ((`mailbox` -join `address` on((`address`.`id` = `mailbox`.`address_id`))) -join `domaines` on((`domaines`.`id` = `address`.`domain_id`))) -where `address`.`enabled` = 1 -; - --- --- Structure de la vue `alias_view` --- - -CREATE OR REPLACE VIEW `alias_view` AS -select concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`, -concat(if(isnull(`mailbox`.`id`),'',concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),`recipient`.`recipients`) AS `alias` -from (((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`))) -left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`))) -join `domaines` on((`domaines`.`id` = `address`.`domain_id`))) -where `address`.`enabled` = 1 -union -select distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`, -`m`.`mail` AS `alias` -from ((`membres` `m` join `variable` `v`) join `domaines` `d`) -where (`v`.`name` = 'mailname_bounce'); -- @@ -483,3 +448,38 @@ update mail_domain, domaines, mail_alias -- End of insert data into new model from old model. -- ------------------------------------------------- +-- +-- Structure de la vue `dovecot_view` +-- +CREATE OR REPLACE VIEW `dovecot_view` AS +SELECT concat(`address`.`address`,'@',`domaines`.`domaine`) AS `user`, +concat('*:storage=',cast(`mailbox`.`quota` as char charset latin1),'M') AS `userdb_quota_rule`, +`address`.`password` AS `password`, +`mailbox`.`path` AS `userdb_home`, +`domaines`.`compte` AS `userdb_uid`, +`domaines`.`compte` AS `userdb_gid`, +`mailbox`.`bytes` AS `quota_dovecot`, +`mailbox`.`messages` AS `nb_messages` +from ((`mailbox` +join `address` on((`address`.`id` = `mailbox`.`address_id`))) +join `domaines` on((`domaines`.`id` = `address`.`domain_id`))) +where `address`.`enabled` = 1 +; + +-- +-- Structure de la vue `alias_view` +-- + +CREATE OR REPLACE VIEW `alias_view` AS +select concat(`address`.`address`,'@',`domaines`.`domaine`) AS `mail`, +concat(if(isnull(`mailbox`.`id`),'',concat(concat(`address`.`address`,'@',`domaines`.`domaine`),'\n')),`recipient`.`recipients`) AS `alias` +from (((`recipient` join `address` on((`address`.`id` = `recipient`.`address_id`))) +left join `mailbox` on((`mailbox`.`address_id` = `address`.`id`))) +join `domaines` on((`domaines`.`id` = `address`.`domain_id`))) +where `address`.`enabled` = 1 +union +select distinct concat(`m`.`login`,'@',`v`.`value`) AS `mail`, +`m`.`mail` AS `alias` +from ((`membres` `m` join `variable` `v`) join `domaines` `d`) +where (`v`.`name` = 'mailname_bounce'); + diff --git a/squirrelmail/templates/apache2/squirrelmail.conf b/squirrelmail/templates/apache2/squirrelmail.conf index b64aa63b..e74cfa0a 100644 --- a/squirrelmail/templates/apache2/squirrelmail.conf +++ b/squirrelmail/templates/apache2/squirrelmail.conf @@ -5,7 +5,7 @@ DocumentRoot /usr/share/squirrelmail - php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/ + php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/:/etc/mailname php_admin_flag safe_mode off Options Indexes FollowSymLinks