Skip to content

Commit 8100f25

Browse files
author
floria030
committed
use regex for dkim-integration in distribution-specific files, too
1 parent be62371 commit 8100f25

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

install/dist/lib/centos52.lib.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,21 @@ public function configure_amavis() {
144144
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
145145
$content = rf($conf['postfix']['config_dir'].'/master.cf');
146146
// Only add the content if we had not addded it before
147-
if(!stristr($content, 'amavis')) {
147+
if(!preg_match('/^amavis\s+/m', $content)) {
148148
unset($content);
149149
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
150150
af($conf['postfix']['config_dir'].'/master.cf', $content);
151151
$content = rf($conf['postfix']['config_dir'].'/master.cf');
152152
}
153-
if(!stristr($content, '127.0.0.1:10025')) {
153+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
154154
unset($content);
155-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10025.master');
155+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
156156
af($conf['postfix']['config_dir'].'/master.cf', $content);
157157
$content = rf($conf['postfix']['config_dir'].'/master.cf');
158158
}
159-
if(!stristr($content, '127.0.0.1:10027')) {
159+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
160160
unset($content);
161-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10027.master');
161+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
162162
af($conf['postfix']['config_dir'].'/master.cf', $content);
163163
}
164164
unset($content);

install/dist/lib/centos53.lib.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,21 @@ public function configure_amavis() {
145145
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
146146
$content = rf($conf['postfix']['config_dir'].'/master.cf');
147147
// Only add the content if we had not addded it before
148-
if(!stristr($content, 'amavis')) {
148+
if(!preg_match('/^amavis\s+/m', $content)) {
149149
unset($content);
150150
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
151151
af($conf['postfix']['config_dir'].'/master.cf', $content);
152152
$content = rf($conf['postfix']['config_dir'].'/master.cf');
153153
}
154-
if(!stristr($content, '127.0.0.1:10025')) {
154+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
155155
unset($content);
156-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10025.master');
156+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
157157
af($conf['postfix']['config_dir'].'/master.cf', $content);
158158
$content = rf($conf['postfix']['config_dir'].'/master.cf');
159159
}
160-
if(!stristr($content, '127.0.0.1:10027')) {
160+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
161161
unset($content);
162-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10027.master');
162+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
163163
af($conf['postfix']['config_dir'].'/master.cf', $content);
164164
}
165165
unset($content);

install/dist/lib/fedora.lib.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,21 @@ public function configure_amavis() {
500500
if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
501501
$content = rf($conf['postfix']['config_dir'].'/master.cf');
502502
// Only add the content if we had not addded it before
503-
if(!stristr($content, 'amavis')) {
503+
if(!preg_match('/^amavis\s+/m', $content)) {
504504
unset($content);
505505
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
506506
af($conf['postfix']['config_dir'].'/master.cf', $content);
507507
$content = rf($conf['postfix']['config_dir'].'/master.cf');
508508
}
509-
if(!stristr($content, '127.0.0.1:10025')) {
509+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
510510
unset($content);
511-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10025.master');
511+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
512512
af($conf['postfix']['config_dir'].'/master.cf', $content);
513513
$content = rf($conf['postfix']['config_dir'].'/master.cf');
514514
}
515-
if(!stristr($content, '127.0.0.1:10027')) {
515+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
516516
unset($content);
517-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis10027.master');
517+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
518518
af($conf['postfix']['config_dir'].'/master.cf', $content);
519519
}
520520
unset($content);

install/dist/lib/gentoo.lib.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,19 @@ public function configure_amavis()
335335
// Append the configuration for amavisd to the master.cf file
336336
$content = rf($conf['postfix']['config_dir'].'/master.cf');
337337
// Only add the content if we had not addded it before
338-
if(!stristr($content, 'amavis')) {
338+
if(!preg_match('/^amavis\s+/m', $content)) {
339339
unset($content);
340340
$content = $this->get_template_file('master_cf_amavis', true);
341341
af($conf['postfix']['config_dir'].'/master.cf', $content);
342342
$content = rf($conf['postfix']['config_dir'].'/master.cf');
343343
}
344-
if(!stristr($content, '127.0.0.1:10025')) {
344+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
345345
unset($content);
346346
$content = $this->get_template_file('master_cf_amavis10025', true);
347347
af($conf['postfix']['config_dir'].'/master.cf', $content);
348348
$content = rf($conf['postfix']['config_dir'].'/master.cf');
349349
}
350-
if(!stristr($content, '127.0.0.1:10027')) {
350+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
351351
unset($content);
352352
$content = $this->get_template_file('master_cf_amavis10027', true);
353353
af($conf['postfix']['config_dir'].'/master.cf', $content);

install/dist/lib/opensuse.lib.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,23 @@ public function configure_amavis() {
533533
// Append the configuration for amavisd to the master.cf file
534534
if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
535535
$content = rf($conf["postfix"]["config_dir"].'/master.cf');
536-
// Only add the content if we had not addded it before
537-
if(!stristr($content, "127.0.0.1:10025")) {
536+
// Only add the content if we had not addded it before
537+
if(!preg_match('/^amavis\s+/m', $content)) {
538+
unset($content);
539+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
540+
af($conf['postfix']['config_dir'].'/master.cf', $content);
541+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
542+
}
543+
if(!preg_match('/^127.0.0.1:10025\s+/m', $content)) {
544+
unset($content);
545+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master');
546+
af($conf['postfix']['config_dir'].'/master.cf', $content);
547+
$content = rf($conf['postfix']['config_dir'].'/master.cf');
548+
}
549+
if(!preg_match('/^127.0.0.1:10027\s+/m', $content)) {
538550
unset($content);
539-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
540-
af($conf["postfix"]["config_dir"].'/master.cf', $content);
551+
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master');
552+
af($conf['postfix']['config_dir'].'/master.cf', $content);
541553
}
542554
unset($content);
543555

0 commit comments

Comments
 (0)