diff -ur amavis-perl-11.orig/amavis/amavis.in amavis-perl-11/amavis/amavis.in --- amavis-perl-11.orig/amavis/amavis.in Thu Apr 5 20:22:52 2001 +++ amavis-perl-11/amavis/amavis.in Thu Feb 14 18:11:53 2002 @@ -333,10 +333,7 @@ # Quarantine the original email message? if ($TESTING ne "yes") { if ($virusbackup eq "yes") { - $VIRUSFILE = "virus-" . strftime("%Y%m%d-%H%M%S", localtime) . "-" . "$$"; - `mv $TEMPDIR/email.txt $QUARANTINE/$VIRUSFILE`; - - do_log(0,"Virus found - quarantined as $VIRUSFILE"); + do_quarantine("Virus found"); } else { do_log(0,"Virus found - not quarantined"); } @@ -362,6 +359,14 @@ } # +sub do_quarantine(@) { + my $reason = shift; + $VIRUSFILE = "virus-" . strftime("%Y%m%d-%H%M%S", localtime) . "-" . "$$"; + `mv $TEMPDIR/email.txt $QUARANTINE/$VIRUSFILE`; + do_log(0,"$reason - quarantined as $VIRUSFILE"); +} + +# # Notify sender sub warn_sender() { return 0 if ($SENDER eq "<>"); @@ -373,7 +378,7 @@ # # Notify admin -sub warn_admin() { +sub warn_admin(@) { my $output = shift; open(MAIL, "|$sendmail_wrapper $sendmail_wrapper_args -f$mailfrom") || do_exit($REGERR, __LINE__);@warn_admin_frag@ @@ -426,12 +431,17 @@ do_log(4,"Extracting mime components"); $entity = $parser->parse($fileh); - # cheat if input is not a mail message - # this means that we can feed ordinary files to amavis - if ($parser->last_error ne "") { - link "$TEMPDIR/email.txt", "$TEMPDIR/parts/email.txt"; - } $fileh->seek(0,0); + + if ($entity->stringify_header =~ /\r/) { + my $logmsg = "Stray in header"; + if ($TESTING ne "yes") { + do_quarantine("$logmsg"); + push (@virusname, "$logmsg"); + warn_admin("$logmsg"); + do_exit($VIRUSERR, __LINE__); + } + } # Extract and decode each part to the extent possible diff -ur amavis-perl-11.orig/tests/Makefile.am amavis-perl-11/tests/Makefile.am --- amavis-perl-11.orig/tests/Makefile.am Thu Mar 8 15:58:34 2001 +++ amavis-perl-11/tests/Makefile.am Thu Feb 14 18:09:21 2002 @@ -9,6 +9,7 @@ amavis-test: ../amavis/amavis @sed -e '/^my $$TESTING/ s/no/yes/' \ + -e '/^my $$DO_SYSLOG/ s/yes/no/' \ -e '/^my $$LOGDIR/ s%"[^"]*"%"$(top_builddir)/tests"%' \ -e '/^my $$log_level/ s/0/5/' \ -e '/^my $$TEMPBASE/ s%"[^"]*"%"/tmp"%' \