File indexing completed on 2025-01-05 04:49:33

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 f-prot -archive 3 $TEMPFILE > /dev/null
0015 RC=$?
0016 if [ $RC -eq 0 ] ; then
0017     echo "X-Virus-Flag: no"
0018 else
0019     case $RC in
0020         1 ) DESC="no - Unrecoverable error" ;;
0021         2 ) DESC="no - Selftest failed" ;;
0022         3 ) DESC="yes - Virus-infected object found" ;;
0023         4 ) DESC="no - Reserved" ;;
0024         5 ) DESC="no - Abnormal termination" ;;
0025         6 ) DESC="no - Virus was removed" ;;
0026         7 ) DESC="no - Error, out of memory" ;;
0027         8 ) DESC="yes - Something suspicious found" ;;
0028     esac
0029     echo "X-Virus-Flag: $DESC"
0030 fi
0031 
0032 cat $TEMPFILE
0033 rm $TEMPFILE