[Mimedefang] SURBL lookups no longer happening after upgrade to 2.48

Martin Blapp mb at imp.ch
Wed Nov 3 06:21:29 EST 2004


Hi,

> Not directly related to discussion.
>
> I guess that header was added by MIMEDefang?  How do you fetch original
> SpamAssassin headers into MIMEDefang?  I'd rather have SpamAssassin
> style headers appended (X-Spam-Status, X-Spam-Report, and so on) than
> X-Spam-Score from example mimedefang-filter.

I generate them. I think it would be nice to have something like that in
the example filter but it's not me deciding that. Anyway, here are parts
of our filter ...

#
# keep track of start time
#
my ($done, $start, $TIMEVAL_T);
if (! $skip_checks ) {
	require 'sys/syscall.ph';
	$TIMEVAL_T = "LL";
	$done = $start = pack($TIMEVAL_T, ());
	syscall(&SYS_gettimeofday, $start, 0) != -1
	or die "gettimeofday: $!";
}

[... Call Spamassassin ]

#
# Fix broken formatting done by spamassassin rules.
#

my $fixed_report = "";
if ($hits >= $report_req) {
	$fixed_report = $report;
	$fixed_report =~ s/\n+\z//g;            # fixes for multiline header
	$fixed_report =~ s/\n[\t ]{0,}\n/\n/g;  # removes empty lines
        $fixed_report =~ s/\n/\n\t/g;           # to stop sendmail complaining
}

#
# Use the excellent wrapping function of Text::Wrap.
#
my $firstpart;
my $secondpart;
$Text::Wrap::columns = 60;
$Text::Wrap::huge = 'wrap';
$Text::Wrap::break = '(?<=[\s,])';
if ($names =~ /([0-9A-Z_,]{0,40},)(.*)/ ) {
        $firstpart = $1 . "\n\t";
                $secondpart = Text::Wrap::wrap('',"\t",$2);
                $names = $firstpart . $secondpart;
        } else {
                        $names = Text::Wrap::wrap('',"\t",$names);
        }
}

#
# Get the final scan time
#
my ($seconds, $scantime);
syscall( &SYS_gettimeofday, $done, 0) != -1
        or die "gettimeofday: $!";
my @start = unpack($TIMEVAL_T, $start);
my @done  = unpack($TIMEVAL_T, $done);
# fix microseconds
for ($done[1], $start[1]) {
                $_ /= 1_000_000
        }
        $scantime = sprintf "%.4f", ($done[0]  + $done[1]  ) - ($start[0] + $start[1] );
        $seconds = "\"" . $scantime . " seconds\"";
}

action_add_header("X-Spam-Report", "$fixed_report");
action_add_header("X-Spam-Status", "No, hits=$hits scantime=$seconds tests=$names");

Martin



More information about the MIMEDefang mailing list