From fe0bcfec3cbecd71260038b6136a14e48750dc7f Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 20 Nov 2013 11:45:35 +0100 Subject: [PATCH] Add clamd scans support --- root/etc/e-smith/templates/etc/dl.php/60ClamScan | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 root/etc/e-smith/templates/etc/dl.php/60ClamScan diff --git a/root/etc/e-smith/templates/etc/dl.php/60ClamScan b/root/etc/e-smith/templates/etc/dl.php/60ClamScan new file mode 100644 index 0000000..5ba6ab5 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/60ClamScan @@ -0,0 +1,21 @@ +{ +my $clam = $clamd{'status'} || 'disabled'; +return '' unless ($clam eq 'enabled'); +my $max = $clamav{StreamMaxLength} || '25M'; +my $limit = $max +$limit =~ s/[KMG]$//; +if ($max =~ m/G$/){ + $limit = $limit * 1024 * 1024 * 1024; +} +elsif ($max =~ m/M$/){ + $limit = $limit * 1024 * 1024; +} +elsif ($max =~ m/K$/){ + $limit = $limit * 1024; +} +# 1MB of margin to be sure we don't go over clamd limit +$limit -= 1024 * 1024; +$OUT .=<<"EOF"; +\$clamdScan = 'unix:///var/clamav/clamd.socket'; +\$scanMax = $limit; +}