File indexing completed on 2024-12-22 05:00:59

0001 #!/bin/sh
0002 #
0003 #    This file is part of KMail.
0004 #    SPDX-FileCopyrightText: 2004 Fred Emmott <fred87@users.sf.net>
0005 #
0006 #    SPDX-License-Identifier: GPL-2.0-only
0007 #
0008 TEMPFILE=`mktemp` 
0009 if [ $? != 0 ] ; then 
0010     TEMPFILE=`mktemp /tmp/kmail.XXXXXX` 
0011 fi 
0012 export TEMPFILE
0013 cat > $TEMPFILE
0014 
0015 # check for a running daemon
0016 if [ "`ps -axo comm|grep clamd`" = "clamd" ]; then
0017     chmod a+r $TEMPFILE
0018     CLAMCOMANDO="clamdscan --stdout --no-summary "
0019 else
0020     CLAMCOMANDO="clamscan --stdout --no-summary"
0021 fi
0022 
0023 # analyze the message
0024 if $CLAMCOMANDO $TEMPFILE | grep -q FOUND; then
0025     echo "X-Virus-Flag: yes"
0026 else
0027     echo "X-Virus-Flag: no"
0028 fi
0029 
0030 cat $TEMPFILE
0031 rm $TEMPFILE