Skip to content

Commit be62371

Browse files
author
floria030
committed
use regex to check for amavis-related config-lines in postfix master.cf
1 parent 7883fc5 commit be62371

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

install/lib/installer_base.lib.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,19 +1040,19 @@ public function configure_amavis() {
10401040
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
10411041
$content = rf($conf['postfix']['config_dir'].'/master.cf');
10421042
// Only add the content if we had not addded it before
1043-
if(!stristr($content, 'amavis')) {
1043+
if(!preg_match('/^amavis\s+unix\s+/m', $content)) {
10441044
unset($content);
10451045
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
10461046
af($conf['postfix']['config_dir'].'/master.cf', $content);
10471047
$content = rf($conf['postfix']['config_dir'].'/master.cf');
10481048
}
1049-
if(!stristr($content, '127.0.0.1:10025')) {
1049+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
10501050
unset($content);
10511051
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
10521052
af($conf['postfix']['config_dir'].'/master.cf', $content);
10531053
$content = rf($conf['postfix']['config_dir'].'/master.cf');
10541054
}
1055-
if(!stristr($content, '127.0.0.1:10027')) {
1055+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
10561056
unset($content);
10571057
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
10581058
af($conf['postfix']['config_dir'].'/master.cf', $content);
@@ -1063,7 +1063,7 @@ public function configure_amavis() {
10631063
exec('adduser clamav amavis');
10641064

10651065
// Create the director for DKIM-Keys
1066-
if(!is_dir('/var/lib/amavis/dkim')) mkdir('-p /var/lib/amavis/dkim', 0750);
1066+
if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750, true);
10671067
// get shell-user for amavis
10681068
$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
10691069
if(!empty($amavis_user)) {

0 commit comments

Comments
 (0)