Re: adding spamassassin tests -- howto?
On Mon, Apr 19, 2004 at 09:12:37AM -0400, Andrew Schulman wrote:
> > we're looking for the approved "how-to-add-a-custom-test to
> > spamassassin" method...
>
> http://wiki.apache.org/spamassassin/WritingRules
that's important information. good site -- thanks for the link.
but the tests we need involve a bit more than plain old regex
matching, so we need to CREATE OUR OWN EVAL TESTS in perl:
spamassassin prefs:
header NONALPHA_RATIO eval:check_nonalpha_chars('Subject', 0.2, 3)
perl EvalTests.pm code:
# raise a flag on headers such as
# Subject: Real Good XX3NICAL__ ULTR@M__ F!0RIC3T__ CI@_LiS__ V1AGR0__ TR_AM_AD0L
sub check_nonalpha_chars {
my ($self, $header, $ratio, $count) = @_;
$header .= ":raw" unless ($header eq "ALL" || $header =~ /:raw$/);
my $str = $self->get($header);
return 0 unless $str;
# ditch whitespace
$str =~ s/\s+//g;
# count nonalpha characters
my $nonalpha = () = ($str =~ /[^A-Za-z]/g);
my $is = $nonalpha / length($str);
return ( ($nonalpha >= $count && $is >= $ratio) ? "$is" : undef );
}
that's not something a regex can handle.
we could put it into /usr/share/perl5/Mail/SpamAssassin/EvalTests.pm
but that doesn't feel kosher. what's the proper approach?
--
I use Debian/GNU Linux version 3.0;
Linux boss 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i586 unknown
DEBIAN NEWBIE TIP #77 from USM Bish <bish@nde.vsnl.net.in>
:
Oh No ! I have DELETED MY /TMP BY MISTAKE. How do I recreate
it? Here's your goal:
drwxrwxrwt 8 root root 2048 Jan 7 13:34 /tmp
Notice the permisions! As root, do these:
# cd /
# mkdir tmp
# chmod 1777 tmp
# chown root.root tmp
That's all there is to it.
Also see http://newbieDoc.sourceForge.net/ ...
Reply to: