From 192378c4776f6613af7f63f4a96dbb783313d598 Mon Sep 17 00:00:00 2001 From: Andreas Gungl Date: Tue, 20 Dec 2005 19:31:53 +0000 Subject: [PATCH] Make the script aware of running ClamAV daemons to speed up the detection. Patch provided by Oscar Santacreu. Thanks, Oscar. CCMAIL:oscar.santacreu@ua.es svn path=/branches/KDE/3.5/kdepim/; revision=490090 --- avscripts/kmail_clamav.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/avscripts/kmail_clamav.sh b/avscripts/kmail_clamav.sh index 69e2673e2..0a91a80fc 100755 --- a/avscripts/kmail_clamav.sh +++ b/avscripts/kmail_clamav.sh @@ -33,10 +33,21 @@ if [ $? != 0 ] ; then fi export TEMPFILE cat > $TEMPFILE -if clamscan --stdout --no-summary --mbox $TEMPFILE | grep -q FOUND; then -echo "X-Virus-Flag: yes" + +# check for a running daemon +if [ `ps -eo comm|grep clamd` = "clamd" ]; then + chmod a+r $TEMPFILE + CLAMCOMANDO="clamdscan --stdout --no-summary " else -echo "X-Virus-Flag: no" + CLAMCOMANDO="clamscan --stdout --no-summary --mbox" fi + +# analyze the message +if $CLAMCOMANDO $TEMPFILE | grep -q FOUND; then + echo "X-Virus-Flag: yes" +else + echo "X-Virus-Flag: no" +fi + cat $TEMPFILE rm $TEMPFILE