diff --git a/install/sql/incremental/upd_0099.sql b/install/sql/incremental/upd_0099.sql new file mode 100644 index 0000000000000000000000000000000000000000..b822310c94eeef03c86a65edf06d70f8aeae705c --- /dev/null +++ b/install/sql/incremental/upd_0099.sql @@ -0,0 +1,6 @@ +ALTER TABLE `spamfilter_policy` +CHANGE `warnvirusrecip` `warnvirusrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N', +CHANGE `warnbannedrecip` `warnbannedrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N', +CHANGE `warnbadhrecip` `warnbadhrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N'; +ALTER TABLE `sys_ini` CHANGE `default_logo` `default_logo` TEXT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL; +ALTER TABLE `sys_ini` CHANGE `custom_logo` `custom_logo` TEXT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 75529ab82b50735e6bd00e22f31d791d430514d4..ff582262bb237936e4f514df17f764e140e72ae3 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1532,9 +1532,9 @@ CREATE TABLE `spamfilter_policy` ( `addr_extension_spam` varchar(64) default NULL, `addr_extension_banned` varchar(64) default NULL, `addr_extension_bad_header` varchar(64) default NULL, - `warnvirusrecip` enum('N','Y') default 'N', - `warnbannedrecip` enum('N','Y') default 'N', - `warnbadhrecip` enum('N','Y') default 'N', + `warnvirusrecip` VARCHAR(1) NULL default 'N', + `warnbannedrecip` VARCHAR(1) NULL default 'N', + `warnbadhrecip` VARCHAR(1) NULL default 'N', `newvirus_admin` varchar(64) default NULL, `virus_admin` varchar(64) default NULL, `banned_admin` varchar(64) default NULL, @@ -1741,8 +1741,8 @@ CREATE TABLE `sys_group` ( CREATE TABLE `sys_ini` ( `sysini_id` int(11) unsigned NOT NULL auto_increment, `config` longtext, - `default_logo` text NOT NULL, - `custom_logo` text NOT NULL, + `default_logo` text NULL, + `custom_logo` text NULL, PRIMARY KEY (`sysini_id`) ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; diff --git a/install/update.php b/install/update.php index e03b5d9de10c740478a81b7c12fe2b9af126ffb0..55b711da739eeb96e9b25641816a79a5f2205848 100644 --- a/install/update.php +++ b/install/update.php @@ -279,11 +279,33 @@ $inst->check_mysql_version(); //* initialize the master DB, if we have a multiserver setup if($conf['mysql']['master_slave_setup'] == 'y') { + //** Get MySQL root credentials + $finished = false; + do { + $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); + $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); + $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); + + //* Initialize the MySQL server connection + if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { + $conf['mysql']['master_host'] = $tmp_mysql_server_host; + $conf['mysql']['master_port'] = $tmp_mysql_server_port; + $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['master_database'] = $tmp_mysql_server_database; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); + } + } while ($finished == false); + unset($finished); // initialize the connection to the master database $inst->dbmaster = new db(); if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_ispconfig_user"], $conf['mysql']["master_ispconfig_password"], $conf['mysql']["master_port"]); + $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"], $conf['mysql']["master_port"]); $inst->dbmaster->setDBName($conf['mysql']["master_database"]); } else { $inst->dbmaster = $inst->db; @@ -330,35 +352,6 @@ unset($tmp); $reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes', 'no'), 'no','reconfigure_permissions_in_master_database'); if($reconfigure_master_database_rights_answer == 'yes') { - //** Get MySQL root credentials, to upgrade the dbmaster connection. - $finished = false; - do { - $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); - $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); - $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); - - //* Initialize the MySQL server connection - if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { - $conf['mysql']['master_host'] = $tmp_mysql_server_host; - $conf['mysql']['master_port'] = $tmp_mysql_server_port; - $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; - $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; - $conf['mysql']['master_database'] = $tmp_mysql_server_database; - $finished = true; - } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); - } - } while ($finished == false); - unset($finished); - - // initialize the connection to the master database - $inst->dbmaster = new db(); - if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"], $conf['mysql']["master_port"]); - $inst->dbmaster->setDBName($conf['mysql']["master_database"]); - $inst->grant_master_database_rights(); } //} diff --git a/interface/web/dns/form/dns_caa.tform.php b/interface/web/dns/form/dns_caa.tform.php index aa297f29d77bd3a8018d25027fdefae628fedeb7..c17f66e181793324c94d5b281e406932020316c7 100644 --- a/interface/web/dns/form/dns_caa.tform.php +++ b/interface/web/dns/form/dns_caa.tform.php @@ -51,7 +51,7 @@ $form['tabs']['dns'] = array ( 'type' => 'TOLOWER') ), 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-9\.\-\_]{0,255}$/', + 'regex' => '/^[a-zA-Z0-9\.\-\_\*]{0,255}$/', 'errmsg'=> 'name_error_regex'), ), 'default' => '', diff --git a/interface/web/mail/ajax_get_json.php b/interface/web/mail/ajax_get_json.php index c40c3bf401bdb0a06af0487a0f9104467bca3317..1a87d8f96bd11b2b684ee4b0095696eb642306ec 100644 --- a/interface/web/mail/ajax_get_json.php +++ b/interface/web/mail/ajax_get_json.php @@ -34,8 +34,10 @@ require_once '../../lib/app.inc.php'; //* Check permissions for module $app->auth->check_module_permissions('mail'); +$app->uses('functions'); + $type = $_GET['type']; -$domain_id = $_GET['domain_id']; +$domain_id = $app->functions->idn_encode($_GET['domain_id']); if($type == 'create_dkim' && $domain_id != ''){ $dkim_public = $_GET['dkim_public']; diff --git a/interface/web/mailuser/templates/mail_user_filter_list.htm b/interface/web/mailuser/templates/mail_user_filter_list.htm index b81793b63189926c8b1f3a25b1f2a06d9b96acce..8ec5641cbf7fde3dfc115eb3089836fcf04a2b62 100644 --- a/interface/web/mailuser/templates/mail_user_filter_list.htm +++ b/interface/web/mailuser/templates/mail_user_filter_list.htm @@ -21,7 +21,7 @@ - + diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index 08f039b3710de060a8ff0a0a212833b9087c46d2..ea3cb2d04ff27431e4bd89a5960fcda0ac0383f7 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -229,7 +229,7 @@ class cron_jailkit_plugin { function _setup_jailkit_chroot() { - global $app; + global $app, $conf; if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) { if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') { @@ -293,7 +293,7 @@ class cron_jailkit_plugin { $programs = $this->jailkit_config['jailkit_chroot_app_programs'] . ' ' . $this->jailkit_config['jailkit_chroot_cron_programs']; - if ($update_hash == $parent_domain['last_jailkit_hash']) { + if ($update_hash == $this->parent_domain['last_jailkit_hash']) { return; } diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php index c3a60d0bb9d6afdcada299c25beabe1eaa26e7c7..0e40d3b71f1245eb2e1aa781c6ac604b5b93e094 100644 --- a/server/plugins-available/rspamd_plugin.inc.php +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -282,74 +282,76 @@ class rspamd_plugin { $app->system->mkdirpath($this->users_config_dir); } - if((!$this->isValidEmail($app->functions->idn_encode($email_address))) || !isset($data['new']['policy_id']) || intval($data['new']['policy_id']) == 0 && $type == 'spamfilter_user') { - if(is_file($settings_file)) { - unlink($settings_file); - } - } else { - - $app->load('tpl'); - - $tpl = new tpl(); - if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) { - $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master"); + if ($type == 'spamfilter_user'){ + if((!$this->isValidEmail($app->functions->idn_encode($email_address))) || !isset($data['new']['policy_id']) || intval($data['new']['policy_id']) == 0) { + if(is_file($settings_file)) { + unlink($settings_file); + } } else { - $tpl->newTemplate("rspamd_users.inc.conf.master"); - } - $tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id); - $tpl->setVar('priority', $settings_priority); + $app->load('tpl'); - if($type === 'spamfilter_user') { - if($data[$use_data]['local'] === 'Y') { - $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); + $tpl = new tpl(); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master"); } else { - $tpl->setVar('from_email', $app->functions->idn_encode($email_address)); + $tpl->newTemplate("rspamd_users.inc.conf.master"); } - // unneded? $spamfilter appears unused - $spamfilter = $data[$use_data]; - } else { - $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); - // need to get matching spamfilter user if any - // unneded? $spamfilter appears unused - $spamfilter = $app->db->queryOneRecord('SELECT * FROM spamfilter_users WHERE `email` = ?', $email_address); - } + $tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id); + $tpl->setVar('priority', $settings_priority); + + if($type === 'spamfilter_user') { + if($data[$use_data]['local'] === 'Y') { + $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); + } else { + $tpl->setVar('from_email', $app->functions->idn_encode($email_address)); + } + // unneded? $spamfilter appears unused + $spamfilter = $data[$use_data]; + } else { + $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); - if(!isset($policy['rspamd_spam_tag_level'])) { - $policy['rspamd_spam_tag_level'] = 6.0; - } - if(!isset($policy['rspamd_spam_tag_method'])) { - $policy['rspamd_spam_tag_method'] = 'add_header'; - } - if(!isset($policy['rspamd_spam_kill_level'])) { - $policy['rspamd_spam_kill_level'] = 15.0; - } - if(!isset($policy['rspamd_virus_kill_level'])) { - $policy['rspamd_virus_kill_level'] = floatval($policy['rspamd_spam_kill_level']) + 1000; - } + // need to get matching spamfilter user if any + // unneded? $spamfilter appears unused + $spamfilter = $app->db->queryOneRecord('SELECT * FROM spamfilter_users WHERE `email` = ?', $email_address); + } - $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); - $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); - $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); - $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); + if(!isset($policy['rspamd_spam_tag_level'])) { + $policy['rspamd_spam_tag_level'] = 6.0; + } + if(!isset($policy['rspamd_spam_tag_method'])) { + $policy['rspamd_spam_tag_method'] = 'add_header'; + } + if(!isset($policy['rspamd_spam_kill_level'])) { + $policy['rspamd_spam_kill_level'] = 15.0; + } + if(!isset($policy['rspamd_virus_kill_level'])) { + $policy['rspamd_virus_kill_level'] = floatval($policy['rspamd_spam_kill_level']) + 1000; + } - if(isset($policy['spam_lover']) && $policy['spam_lover'] == 'Y') { - $tpl->setVar('spam_lover', true); - } - if(isset($policy['virus_lover']) && $policy['virus_lover'] == 'Y') { - $tpl->setVar('virus_lover', true); - } + $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); + $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); + $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); + $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); - $tpl->setVar('greylisting', $greylisting); + if(isset($policy['spam_lover']) && $policy['spam_lover'] == 'Y') { + $tpl->setVar('spam_lover', true); + } + if(isset($policy['virus_lover']) && $policy['virus_lover'] == 'Y') { + $tpl->setVar('virus_lover', true); + } - if(isset($policy['rspamd_spam_greylisting_level'])) { - $tpl->setVar('greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); - } else { - $tpl->setVar('greylisting_level', 0.1); - } + $tpl->setVar('greylisting', $greylisting); - $app->system->file_put_contents($settings_file, $tpl->grab()); + if(isset($policy['rspamd_spam_greylisting_level'])) { + $tpl->setVar('greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); + } else { + $tpl->setVar('greylisting_level', 0.1); + } + + $app->system->file_put_contents($settings_file, $tpl->grab()); + } } }