From 901c4c7a85e3056c5e86a0b19cfdccc1003f00ca Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Wed, 18 Dec 2013 20:01:19 -0200 Subject: mailscanner - fix/disable pyzor check and change mailscanner bin from perl version to a perl_mailscanner alias. --- config/mailscanner/mailscanner.inc | 46 ++++++++++++++++------------- config/mailscanner/mailscanner.xml | 2 +- config/mailscanner/mailscanner_antispam.xml | 2 +- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/config/mailscanner/mailscanner.inc b/config/mailscanner/mailscanner.inc index f15f7c61..9f5fd11d 100644 --- a/config/mailscanner/mailscanner.inc +++ b/config/mailscanner/mailscanner.inc @@ -442,15 +442,21 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf } if (preg_match('/use_pyzor/',$antispam['safeatures'])){ $pattern[]='/#pyzor_path/'; + $pattern[]="/\S+yzor_disabled/"; $pattern[]='/usr.bin.pyzor/'; - $pattern[]='/\nuse_pyzor\s+0/'; + $pattern[]='/use_pyzor/'; + $pattern[]="/\S+o_not_use_pyzor/"; + $replacement[]="pyzor_path"; $replacement[]="pyzor_path"; $replacement[]="usr/local/bin/pyzor"; - $replacement[]="\n".'# use_pyzor 0'; + $replacement[]="use_pyzor"; + $replacement[]="use_pyzor"; } else{ - $pattern[]='/\n#\s+use_pyzor\s+0/'; - $replacement[]="\n".'# use_pyzor 0'; + $pattern[]='/use_pyzor/'; + $pattern[]='/pyzor_path/'; + $replacement[]="#do_not_use_pyzor"; + $replacement[]="#pyzor_disabled"; } if (preg_match('/use_auto_learn_bayes/',$antispam['safeatures'])){ $pattern[]='/\nbayes_auto_learn\s+0/'; @@ -677,23 +683,23 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf #fix MIME::ToolUtils deprecated function and usecure dependency calls in /usr/local/sbin/mailscanner $cconf=MAILSCANNER_LOCALBASE. "/sbin/mailscanner"; if (file_exists($cconf)){ - #check perl's version - $perl_bin="perl"; - $perl_version_file=MAILSCANNER_LOCALBASE . '/etc/perl5_version'; - if (file_exists($perl_version_file)) { - $perl_version = trim(`/usr/bin/grep 'PERL_VERSION=' $perl_version_file | /usr/bin/cut -f2 -d'='`); - $perl_bin .= $perl_version; + + $perl_bin="perl_mailscanner"; + if(file_exists(MAILSCANNER_LOCALBASE . '/bin/perl') && !file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){ + link(MAILSCANNER_LOCALBASE . '/bin/perl',MAILSCANNER_LOCALBASE . '/bin/perl_mailscanner'); } - - $cconf_file=file_get_contents($cconf); - $pattern2[0]='@#!/usr\S+bin/perl.*I@'; - $pattern2[1]='/\smy .current = config MIME::ToolUtils/'; - $replacement2[0]='#!'.MAILSCANNER_LOCALBASE. "/bin/{$perl_bin} -U -I"; - $replacement2[1]=' #my $current = config MIME::ToolUtils'; - if (preg_match('@#!/usr\S+bin/perl.*I@',$cconf_file)){ - $cconf_file=preg_replace($pattern2,$replacement2,$cconf_file); - file_put_contents($cconf, $cconf_file, LOCK_EX); - } + if (file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){ + $cconf_file=file_get_contents($cconf); + $pattern2[0]='@#!/usr\S+bin/perl.*I@'; + //$pattern2[1]='/\smy .current = config MIME::ToolUtils/'; + $replacement2[0]='#!'.MAILSCANNER_LOCALBASE. "/bin/{$perl_bin} -U -I"; + //$replacement2[1]=' #my $current = config MIME::ToolUtils'; + if (preg_match('@#!/usr\S+bin/perl.*I@',$cconf_file)){ + $cconf_file=preg_replace($pattern2,$replacement2,$cconf_file); + file_put_contents($cconf, $cconf_file, LOCK_EX); + } + } + } #check spam assassin rules diff --git a/config/mailscanner/mailscanner.xml b/config/mailscanner/mailscanner.xml index 87be2421..2f97fcec 100644 --- a/config/mailscanner/mailscanner.xml +++ b/config/mailscanner/mailscanner.xml @@ -54,7 +54,7 @@ mailscanner mailscanner - perl5.16.3 + perl_mailscanner MailScanner diff --git a/config/mailscanner/mailscanner_antispam.xml b/config/mailscanner/mailscanner_antispam.xml index 7f989765..26295059 100644 --- a/config/mailscanner/mailscanner_antispam.xml +++ b/config/mailscanner/mailscanner_antispam.xml @@ -169,7 +169,7 @@ - + -- cgit v1.2.3