#!/bin/sh
[ "$1" = "-h" ] && cat <<tac

This example tests the following features of the sanitizer:

   - Converting TNEF to MIME

tac

if [ ! -e /usr/local/bin/f-prot ]; then
    # F-Prot not installed, fake a successful run.
    echo -n "SKIPPED: F-Prot not installed.  " >&2
    cat $TEST_RESULTS/sanitizer.tnef.ok >test.out
    exit 0
fi
if [ ! -e $ANOMY/bin/Anomy/TNEFStream.pm ]; then
    # ANOMY::TNEFStream not installed, fake a successful run.
    echo -n "SKIPPED: ANOMY::TNEFStream not installed.  " >&2
    cat $TEST_RESULTS/sanitizer.tnef.ok >test.out
    exit 0
fi

# Obfuscation so our distributed package does not trigger AV products...
SKIPPED1="eJ8+IgYEAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5N"
SKIPPED2="aWNyb3NvZnQgTWFpbC5Ob3RlADEIAQ2ABAACAAAAAgACAAEGgAMADgAAANIHBAAZAAUADwAA"
SKIPPED3="AAQADgEBA5AGAHAEAAAjAAAACwACAAEAAAALACMAAAAAAAMAJgAAAAAACwApAAAAAAALACsA"
SKIPPED4="AAAAAAMALgAAAAAAAwA2AAAAAAAeAHAAAQAAADgAAABjb21wYW5pZXMgbWVyZ2UgdG8gZm9y"

$ANOMY/bin/sanitizer.pl -fprot $SAN_CONF \
    'header_rev = 0' \
    'feat_testing = 1' \
    'feat_kill_tnef = 1' \
    'file_list_2_policy  = unknown:drop:drop:defang' \
    'file_name_tpl = ./.tmp.$$$' \
    'feat_log_inline = 1' \
    'feat_log_stderr = 0' <<EOF 2>test.log >test.out
From bre  Fri May 17 19:33:45 2002
Return-Path: <bre@monique.frisk-software.com>
Received: (from bre@localhost)
	by monique.frisk-software.com (8.11.2/8.11.2) id g4HJXjK19121
	for bre@monique.frisk-software.com; Fri, 17 May 2002 19:33:45 GMT
Date: Fri, 17 May 2002 19:33:45 +0000
From: =?iso-8859-1?Q?Bjarni_R=FAnar_Einarsson?= <bre@monique.frisk-software.com>
To: =?iso-8859-1?Q?Bjarni_R=FAnar_Einarsson?= <bre@monique.frisk-software.com>
Subject: Foo!!!
Message-ID: <20020517193345.A14401@monique.frisk-software.com>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI"
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Status: RO
Content-Length: 7496
Lines: 113


--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

ldkj

--oyUTqETQ0mS9luUI
Content-Type: application/ms-tnef
Content-Disposition: attachment; filename="winmail.dat"
Content-Transfer-Encoding: base64

$SKIPPED1
$SKIPPED2
$SKIPPED3
$SKIPPED4
[encoded data, 6935 characters]

--oyUTqETQ0mS9luUI--

EOF
