#!/bin/sh # 20080314 _M Simplified from sniffer script. # This version simply creates a temp file, scans it w/ SNFClient and # sends it on it's way - presumably with headers injected. # Setup These Variable. The rest of the script should be fine as is. INSPECT_DIR=DATADIR/PACKAGE_NAME SNIFFER_EXE=PREFIX/sbin/SNFClient SENDMAIL="/usr/sbin/sendmail -G -i" MSGFILE=$INSPECT_DIR/`date +%Y%m%d%H%M%S`_$$_$RANDOM.msg # Define Exit codes from EX_OK=0 EX_TEMPFAIL=75 EX_UNAVAILABLE=69 # Clean up when when aborting. trap "rm -f *$MSGFILE" 1 2 3 15 # Move to our filter directory where we perform our inspections. cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; } # Copy the message to a temp file for processing. cat > $MSGFILE || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } # Scan the mesage w/ SNF. SNFServer will inject headers. $SNIFFER_EXE $MSGFILE # Scan the message $SENDMAIL "$@" < $MSGFILE # Reinject the message rm -f $MSGFILE # Remove the temp file # All done. exit $EX_OK;