From aa22d5c594a8ff5cb019db1765cfcd815e7cc0e3 Mon Sep 17 00:00:00 2001 From: Arnold Bechtoldt Date: Thu, 8 Mar 2012 17:02:57 +0100 Subject: [PATCH 1/8] Make check of creating e-mail addresses case-insensitive, thanks to d4f, fixes #1021 --- customer_email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customer_email.php b/customer_email.php index b6cebb24..c0198d1b 100644 --- a/customer_email.php +++ b/customer_email.php @@ -237,7 +237,7 @@ elseif($page == 'emails') standard_error('emailiswrong', $email_full); } - $email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE ( `email`='" . $db->escape($email) . "' OR `email_full` = '" . $db->escape($email_full) . "' ) AND `customerid`='" . (int)$userinfo['customerid'] . "'"); + $email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE (`email` LIKE '" . $db->escape($email) . "' OR `email_full` LIKE '" . $db->escape($email_full) . "') AND `customerid`='" . (int)$userinfo['customerid'] . "'"); if($email == '' || $email_full == '' From f957a0a04e34b56367791f5864b61e5acac424b7 Mon Sep 17 00:00:00 2001 From: Arnold Bechtoldt Date: Tue, 29 May 2012 10:21:58 +0200 Subject: [PATCH 2/8] email address validation: using strtolower() with equal-operator to check if address is not already in use, instead of comparing with LIKE-operator, fixes #1021 Signed-off-by: Arnold Bechtoldt --- customer_email.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/customer_email.php b/customer_email.php index c0198d1b..dedcc32e 100644 --- a/customer_email.php +++ b/customer_email.php @@ -237,7 +237,7 @@ elseif($page == 'emails') standard_error('emailiswrong', $email_full); } - $email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE (`email` LIKE '" . $db->escape($email) . "' OR `email_full` LIKE '" . $db->escape($email_full) . "') AND `customerid`='" . (int)$userinfo['customerid'] . "'"); + $email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE (`email` = '" . strtolower($db->escape($email)) . "' OR `email_full` = '" . strtolower($db->escape($email_full)) . "') AND `customerid`='" . (int)$userinfo['customerid'] . "'"); if($email == '' || $email_full == '' @@ -253,7 +253,7 @@ elseif($page == 'emails') { standard_error('maindomainnonexist', $domain); } - elseif($email_check['email_full'] == $email_full) + elseif(strtolower($email_check['email_full']) == strtolower($email_full)) { standard_error('emailexistalready', $email_full); } From f7754e284596c59aae7d4379e3fe6af99fce5734 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jun 2012 17:10:07 -0300 Subject: [PATCH 3/8] Change how email folders are created. Before it was: customer_dir/mail/customer_login/user@domain/ Now it is: customer_dir/mail/customer_login/domain/user/Maildir/ --- customer_email.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/customer_email.php b/customer_email.php index b6cebb24..86356910 100644 --- a/customer_email.php +++ b/customer_email.php @@ -438,8 +438,10 @@ elseif($page == 'accounts') { $password = substr(md5(uniqid(microtime(), 1)), 12, 6); } + $email_user=substr($email_full,0,strrpos($email_full,"@")); + $email_domain=substr($email_full,strrpos($email_full,"@")+1); - $db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_full . '/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y', '" . (int)$quota . "', '" . (int)$userinfo['imap'] . "', '" . (int)$userinfo['pop3'] . "')"); + $db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_domain . "/" . $email_user . '/Maildir/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y', '" . (int)$quota . "', '" . (int)$userinfo['imap'] . "', '" . (int)$userinfo['pop3'] . "')"); $popaccountid = $db->insert_id(); $result['destination'].= ' ' . $email_full; $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '" . (int)$popaccountid . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); From 432e898318e1022146c68bc8fe14989db352136c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADcio=20Zimmerer=20Murta?= Date: Mon, 9 Jul 2012 23:29:03 -0300 Subject: [PATCH 4/8] Additional modifications to domain/user/Maildir email file structure - Added email settings' option to specify Maildir directory (depending on postfix version this is ./Maildir/, .maildir/ or, optionally, one can choose to leave Maildir file structure directly on user's directory. - Fixed database 'insert' command to describe the new structure using specified Maildir directory into new accounts. - Fixed maildirExists function to the new file structure - Fixed older bug that email exclusions that were scheduled (task 7) were not being displayed on overview. - Added entries on 'english' language file for the new entries on panel - Changed task id 6 (delete customer) behavior on scrips/jobs/cron_tasks.php to assure email account is owned to mail uid/gid and the target is an actual directory before zapping it. - Fixed task id 7 (delete customer mail data) behavior on script above to correctly fill and find Maildir and also do additional paranoid checks before zapping the mail account directory. Notice this is not the same from above directory-wise: here we erase a single account's data, while in task id a entire customer set of accounts and domains are eliminated. --- actions/admin/settings/150.mail.php | 11 ++++++- customer_email.php | 31 +++++++++++++++++-- .../filedir/function.maildirExists.php | 5 ++- .../froxlor/function.CronjobFunctions.php | 4 +++ lng/english.lng.php | 4 +++ scripts/jobs/cron_tasks.php | 25 ++++++++++++--- 6 files changed, 70 insertions(+), 10 deletions(-) diff --git a/actions/admin/settings/150.mail.php b/actions/admin/settings/150.mail.php index db4d58bf..fc514f37 100644 --- a/actions/admin/settings/150.mail.php +++ b/actions/admin/settings/150.mail.php @@ -51,6 +51,15 @@ return array( 'default' => '/var/customers/mail/', 'save_method' => 'storeSettingField', ), + 'system_vmail_maildirname' => array( + 'label' => $lng['serversettings']['vmail_maildirname'], + 'settinggroup' => 'system', + 'varname' => 'vmail_maildirname', + 'type' => 'string', + 'string_type' => 'dir', + 'default' => 'Maildir', + 'save_method' => 'storeSettingField', + ), 'panel_sendalternativemail' => array( 'label' => $lng['serversettings']['sendalternativemail'], 'settinggroup' => 'panel', @@ -95,4 +104,4 @@ return array( ), ); -?> \ No newline at end of file +?> diff --git a/customer_email.php b/customer_email.php index 86356910..acc6b9de 100644 --- a/customer_email.php +++ b/customer_email.php @@ -440,12 +440,37 @@ elseif($page == 'accounts') } $email_user=substr($email_full,0,strrpos($email_full,"@")); $email_domain=substr($email_full,strrpos($email_full,"@")+1); + $maildirname=trim($settings['system']['vmail_maildirname']); + // Add trailing slash to Maildir if needed + $maildirpath=$maildirname; + if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/"; - $db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_domain . "/" . $email_user . '/Maildir/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y', '" . (int)$quota . "', '" . (int)$userinfo['imap'] . "', '" . (int)$userinfo['pop3'] . "')"); + $db->query("INSERT INTO `" . TABLE_MAIL_USERS . + "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) ". + "VALUES (". + "'" . (int)$userinfo['customerid'] . "', ". + "'" . $db->escape($email_full) . "', ". + "'" . $db->escape($username) . "', " . + ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "', " : '') . + "ENCRYPT('" . $db->escape($password) . "'), ". + "'" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_domain . "/" . $email_user . "/" . $maildirpath) . "', ". + "'" . (int)$settings['system']['vmail_uid'] . "', ". + "'" . (int)$settings['system']['vmail_gid'] . "', ". + "'" . (int)$result['domainid'] . "', ". + "'y', ". + "'" . (int)$quota . "', ". + "'" . (int)$userinfo['imap'] . "', ". + "'" . (int)$userinfo['pop3'] . "')"); $popaccountid = $db->insert_id(); $result['destination'].= ' ' . $email_full; - $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '" . (int)$popaccountid . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); - $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used`=`email_accounts_used`+1, `email_quota_used`=`email_quota_used`+" . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); + $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET ". + "`destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', ". + "`popaccountid` = '" . (int)$popaccountid . "' ". + "WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); + $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET ". + "`email_accounts_used`=`email_accounts_used`+1, ". + "`email_quota_used`=`email_quota_used`+" . (int)$quota . " ". + "WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added email account for '" . $email_full . "'"); $replace_arr = array( 'EMAIL' => $email_full, diff --git a/lib/functions/filedir/function.maildirExists.php b/lib/functions/filedir/function.maildirExists.php index 5d61cc34..516a940f 100644 --- a/lib/functions/filedir/function.maildirExists.php +++ b/lib/functions/filedir/function.maildirExists.php @@ -30,7 +30,10 @@ function maildirExists($result = null) { $loginname = getCustomerDetail($result['customerid'], 'loginname'); if($loginname !== false) { - $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $loginname .'/'. $result['email_full']); + $email_user=substr($result['email_full'],0,strrpos($result['email_full'],"@")); + $email_domain=substr($result['email_full'],strrpos($result['email_full'],"@")+1); + $maildirname=trim($settings['system']['vmail_maildirname']); + $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $loginname .'/'. $email_domain .'/'. $email_user . (!empty($maildirname)?'/'.$maildirname:'')); if(@file_exists($maildir)) { return true; } diff --git a/lib/functions/froxlor/function.CronjobFunctions.php b/lib/functions/froxlor/function.CronjobFunctions.php index 2ef4063e..ad1c208d 100644 --- a/lib/functions/froxlor/function.CronjobFunctions.php +++ b/lib/functions/froxlor/function.CronjobFunctions.php @@ -209,6 +209,10 @@ function getOutstandingTasks() $task_desc = $lng['tasks']['deleting_customerfiles']; $task_desc = str_replace('%loginname%', $loginname, $task_desc); } + elseif($row['type'] == '7') + { + $task_desc = $lng['tasks']['remove_emailacc_files']; + } /* * Set FS - quota */ diff --git a/lng/english.lng.php b/lng/english.lng.php index 5e1ad674..0fb773da 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1917,3 +1917,7 @@ $lng['panel']['cancel'] = 'Cancel'; $lng['admin']['delete_statistics'] = 'Delete Statistics'; $lng['admin']['speciallogwarning'] = 'WARNING: By changing this setting you will lose all your old statistics for this domain. If you are 100% sure you wish to change this type "'.$lng['admin']['delete_statistics'].'" in the field below and click the "'.$lng['panel']['delete'].'" button.

'; +// ADDED IN 0.9.28-svn2 +$lng['serversettings']['vmail_maildirname']['title'] = 'Maildir name'; +$lng['serversettings']['vmail_maildirname']['description'] = 'Maildir directory into user\'s account. Normally \'Maildir\', in some implementations \'.maildir\', and directly into user\'s directory if left blank.'; +$lng['tasks']['remove_emailacc_files'] = 'Delete customer e-mail data.'; diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php index 874fa213..94216b04 100644 --- a/scripts/jobs/cron_tasks.php +++ b/scripts/jobs/cron_tasks.php @@ -310,7 +310,6 @@ while($row = $db->fetch_array($result_tasks)) safe_exec('rm -rf '.escapeshellarg($backupdir)); } - /* * remove maildir */ @@ -318,7 +317,10 @@ while($row = $db->fetch_array($result_tasks)) if($maildir != '/' && $maildir != $settings['system']['vmail_homedir'] - && substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']) + && substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir'] + && is_dir($maildir) + && fileowner($maildir) == $settings['system']['vmail_uid'] + && filegroup($maildir) == $settings['system']['vmail_gid']) { $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir)); safe_exec('rm -rf '.escapeshellarg($maildir)); @@ -388,11 +390,24 @@ while($row = $db->fetch_array($result_tasks)) /* * remove specific maildir */ - $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $row['data']['email']); + $email_full = $row['data']['email']; + if (empty($email_full)) { + $cronlog->logAction(CRON_ACTION, LOG_ERROR, 'FATAL: Task7 asks to delete a email account but email field is empty!'); + } + $email_user=substr($email_full,0,strrpos($email_full,"@")); + $email_domain=substr($email_full,strrpos($email_full,"@")+1); + $maildirname=trim($settings['system']['vmail_maildirname']); + // Add trailing slash to Maildir if needed + $maildirpath=$maildirname; + if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/"; + $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $email_domain .'/'. $email_user .'/'. $maildirpath); - if($maildir != '/' + if($maildir != '/' && !empty($maildir) && !empty($email_full) && $maildir != $settings['system']['vmail_homedir'] - && substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']) + && substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir'] + && is_dir($maildir) + && fileowner($maildir) == $settings['system']['vmail_uid'] + && filegroup($maildir) == $settings['system']['vmail_gid']) { $cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir)); safe_exec('rm -rf '.escapeshellarg($maildir)); From 72cefb38dbd86f1fbe31b4aa97f58b425413dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADcio=20Zimmerer=20Murta?= Date: Tue, 10 Jul 2012 00:53:20 -0300 Subject: [PATCH 5/8] Setup froxlor update script. --- install/froxlor.sql | 3 ++- install/updates/froxlor/0.9/update_0.9.inc.php | 12 ++++++++++++ lib/tables.inc.php | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/install/froxlor.sql b/install/froxlor.sql index 5aec6b32..460d628d 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -466,10 +466,11 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('syste INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'vmail_uid', '2000'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'vmail_gid', '2000'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'vmail_homedir', '/var/customers/mail/'); +INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'vmail_maildir', 'Maildir'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'bind_enable', '1'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'bindreload_command', '/etc/init.d/bind9 reload'); -INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'version', '0.9.28-svn2'); +INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'version', '0.9.28-svn3'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('login', 'deactivatetime', '900'); diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index bd7a315e..2b6dc620 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -1907,4 +1907,16 @@ if(isFroxlorVersion('0.9.28-svn1')) { updateToVersion('0.9.28-svn2'); } +if(isFroxlorVersion('0.9.28-svn2')) { + showUpdateStep("Updating from 0.9.28-svn2 to 0.9.28-svn3"); + lastStepStatus(0); + // Add default setting for vmail_maildirname if not already in place + $handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' AND `varname` = 'vmail_maildirname';"); + if ($db->num_rows($handle) < 1) { + showUpdateStep("Adding default Maildir value into Mailserver settings."); + $db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'vmail_maildirname', 'Maildir');"); + } + + updateToVersion('0.9.28-svn3'); +} diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 8d59240c..54a0ed09 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -73,6 +73,6 @@ define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.28-svn2'; +$version = '0.9.28-svn3'; $dbversion = '2'; $branding = ''; From 1c3690a88208f897c73892bc0d6efaceb8ba9651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADcio=20Zimmerer=20Murta?= Date: Tue, 10 Jul 2012 00:54:03 -0300 Subject: [PATCH 6/8] Erase full user dir instead of just Maildir/ when erasing customer email data. --- scripts/jobs/cron_tasks.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php index 94216b04..76b18fa9 100644 --- a/scripts/jobs/cron_tasks.php +++ b/scripts/jobs/cron_tasks.php @@ -400,12 +400,13 @@ while($row = $db->fetch_array($result_tasks)) // Add trailing slash to Maildir if needed $maildirpath=$maildirname; if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/"; - $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $email_domain .'/'. $email_user .'/'. $maildirpath); + $maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $email_domain .'/'. $email_user); if($maildir != '/' && !empty($maildir) && !empty($email_full) && $maildir != $settings['system']['vmail_homedir'] && substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir'] - && is_dir($maildir) + && is_dir($maildir) + && is_dir(makeCorrectDir($maildir.'/'.$maildirpath)) && fileowner($maildir) == $settings['system']['vmail_uid'] && filegroup($maildir) == $settings['system']['vmail_gid']) { From 437a92d0b5e8be299c124163d06d5f2910f383a8 Mon Sep 17 00:00:00 2001 From: anbrosius Date: Sun, 22 Jul 2012 14:51:02 +0200 Subject: [PATCH 7/8] Fix bug IMAP/POP3 after reactivating a customer --- admin_customers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_customers.php b/admin_customers.php index 52eb0fc1..5c12dcfd 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -1238,7 +1238,7 @@ if($page == 'customers' if($deactivated != $result['deactivated']) { - $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `postfix`='" . (($deactivated) ? 'N' : 'Y') . "', `pop3`='" . (($deactivated) ? '0' : '1') . "', `imap`='" . (($deactivated) ? '0' : '1') . "' WHERE `customerid`='" . (int)$id . "'"); + $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `postfix`='" . (($deactivated) ? 'N' : 'Y') . "', `pop3`='" . (($deactivated) ? '0' : (int)$result['pop3']) . "', `imap`='" . (($deactivated) ? '0' : (int)$result['imap']) . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `login_enabled`='" . (($deactivated) ? 'N' : 'Y') . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `deactivated`='" . (int)$deactivated . "' WHERE `customerid`='" . (int)$id . "'"); From cac5f7a204c35733057c8db98b7dae554b675505 Mon Sep 17 00:00:00 2001 From: anbrosius Date: Tue, 24 Jul 2012 01:06:45 +0200 Subject: [PATCH 8/8] Fix ticket #1068: uncheck specialsettings for subdomains --- admin_domains.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_domains.php b/admin_domains.php index b6a81e39..bed62fe7 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -1126,7 +1126,7 @@ if($page == 'domains' $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `domains_used` = `domains_used` - 1 WHERE `adminid` = '" . (int)$result['adminid'] . "' "); } - $ssfs = isset($_POST['specialsettingsforsubdomains']) ? intval($_POST['specialsettingsforsubdomains']) : 1; + $ssfs = isset($_POST['specialsettingsforsubdomains']) ? 1 : 0; if($ssfs == 1) { $upd_specialsettings = ", `specialsettings`='" . $db->escape($specialsettings) . "' ";