[pmg-devel] [PATCH pmg-api 1/1] Add disable_clamav and convert_tnef_in
Davide Bozzelli
davide.bozzelli at gci.it
Sat Mar 17 18:55:46 CET 2018
Signed-off-by: Davide Bozzelli <buzzz at gci.it>
---
PMG/Config.pm | 12 ++++++++++++
PMG/Utils.pm | 15 +++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/PMG/Config.pm b/PMG/Config.pm
index 267e3c8..c8b9191 100755
--- a/PMG/Config.pm
+++ b/PMG/Config.pm
@@ -97,6 +97,16 @@ sub properties {
type => 'boolean',
default => 0,
},
+ disable_clamav => {
+ description => "Disable Clamav Antivirus",
+ type => 'boolean',
+ default => 0,
+ },
+ convert_tnef_in => {
+ description => "Convert TNEF aka Winmail.dat messages",
+ type => 'boolean',
+ default => 0,
+ },
};
}
@@ -104,6 +114,8 @@ sub options {
return {
advfilter => { optional => 1 },
avast => { optional => 1 },
+ convert_tnef_in => { optional => 1 },
+ disable_clamav => { optional => 1 },
statlifetime => { optional => 1 },
dailyreport => { optional => 1 },
demo => { optional => 1 },
diff --git a/PMG/Utils.pm b/PMG/Utils.pm
index 6689d10..4bae93e 100644
--- a/PMG/Utils.pm
+++ b/PMG/Utils.pm
@@ -400,16 +400,23 @@ sub analyze_virus {
return $vinfo_avast || $vinfo_clam;
}
- my $enable_avast = $pmg_cfg->get('admin', 'avast');
-
+ my $enable_avast = $pmg_cfg->get('admin', 'avast');
+ my $disable_clamav = $pmg_cfg->get('admin', 'disable_clamav');
+
if ($enable_avast) {
if (my $vinfo = analyze_virus_avast($queue, $filename, $pmg_cfg)) {
return $vinfo;
}
}
- # always scan with clamav
- return analyze_virus_clam($queue, $filename, $pmg_cfg);
+ ## scan with clamav if not explicity disabled
+ if ( !$disable_clamav || !defined $disable_clamav ) {
+ if ( my $vinfo = analyze_virus_clam($queue, $filename, $pmg_cfg) ) {
+ return $vinfo;
+ }
+ }
+
+ return undef ;
}
sub magic_mime_type_for_file {
--
2.11.0
More information about the pmg-devel
mailing list