[Mimedefang] mimedefang-filter config problem
NFN Smith
worldoff9908 at sacbeemail.com
Fri Sep 24 16:49:08 EDT 2004
This will take a bit of explaining, so please bear with me.
I'm working with an up-line provider on implementing SpamAssassin and
MIMEDefang, and having problems with rewriting subject lines to include
a SA score.
In this particular installation, we have MIMEDefang running with a lot
of customized routines that do extensive header rewriting. The box in
question is running RH 7.3, sendmail 8.12.8-1, mimedefang-2.25-1 and
spamassassin-2.64-1, all of which have been installed from RPM
distributions.
What's happening is if we add the following to sub filter_end:
action_change_header("Subject", "[SPAM: $hits] $Subject");
then running:
perl -cw mimedefang-filter
we get the following response:
> Global symbol "$Subject" requires explicit package name at
> mimedefang-filter line 549. mimedefang-filter had compilation errors.
For this, line 549 is a comment line, where the previous line of active
code is:
if (-s "./INPUTMSG" < 100*1024) {
that is, the test to ignore a message if it's larger than 100K. If we
comment out the action_change_header line (as quoted above), the problem
goes away. In the same way, excluding $Subject from that line also
makes the problem go away.
If I copy this mimedefang-filter file over to a different box (this one
running Fedora Core-2, sendmail 8.13.1, mimedefang 2.44 and spamassassin
2.64, all built from tarball), we get a different, but similar error:
> Global symbol "$Subject" requires explicit package name at
> /tmp/mimedefang-filter line 573, <DATA> line 225. /tmp/mimedefang-filter
> had compilation errors.
In this, line 225 is in the set of customized routines, and line 573 is
the active 'action_change_header' line. For reference, I've quoted the
entirety of sub filter_end below (excluding comment lines).
fen_post_filter is a call to one of our customized routines.
(The Fedora box has a different mimedefang-filter running, without all
the customized header rewriting, and in the mimedefang-filter it runs,
it has no problem with rewriting the subject line, using identical
syntax with action_change_header.)
In this situation, why are we not able to get to the contents of
$Subject? How do we work around this problem?
Thanks in advance.
Smith
> sub filter_end ($) {
> my($entity) = @_;
>
> # No sense doing any extra work
> return if message_rejected();
>
> # Spam checks if SpamAssassin is installed
> if ($Features{"SpamAssassin"}) {
> if (-s "./INPUTMSG" < 100*1024) {
> my($hits, $req, $names, $report) = spam_assassin_check();
> if ($hits >= $req) {
> md_log('spam', $hits, $RelayAddr);
> my($score);
> if ($hits < 20) {
> $score = "*" x int($hits);
> } else {
> $score = "*" x 20;
> }
> action_change_header("X-Spam-Score", "$hits ($score) $names");
>
> # If you find the SA report useful, add it, I guess...
> action_add_part($entity, "text/plain", "-suggest",
> "$report\n",
> "SpamAssassinReport.txt", "inline");
> ##### action_change_header("Subject", "[SPAM: $hits] $Subject");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The problem line of code.
> action_add_header("X-Spam-Status", "Yes");
> } else {
> # Delete any existing X-Spam-Score header?
> action_delete_header("X-Spam-Score");
> action_add_header("X-Spam-Status", "No");
> }
> }
> }
> fen_post_filter($entity);
> }
---
More information about the MIMEDefang
mailing list