You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2006/11/13 23:43:25 UTC
svn commit: r474547 - in /spamassassin/rules/trunk/sandbox/jm:
20_receivedfrom.cf ReceivedFrom.pm
Author: jm
Date: Mon Nov 13 14:43:24 2006
New Revision: 474547
URL: http://svn.apache.org/viewvc?view=rev&rev=474547
Log:
add new test rule to match forged Received header referring to From address: T_JM_RCVD_FROM
Added:
spamassassin/rules/trunk/sandbox/jm/20_receivedfrom.cf
spamassassin/rules/trunk/sandbox/jm/ReceivedFrom.pm
Added: spamassassin/rules/trunk/sandbox/jm/20_receivedfrom.cf
URL: http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/20_receivedfrom.cf?view=auto&rev=474547
==============================================================================
--- spamassassin/rules/trunk/sandbox/jm/20_receivedfrom.cf (added)
+++ spamassassin/rules/trunk/sandbox/jm/20_receivedfrom.cf Mon Nov 13 14:43:24 2006
@@ -0,0 +1,10 @@
+
+# commented; just not really up to snuff right now
+#
+loadplugin Mail::SpamAssassin::Plugin::ReceivedFrom ReceivedFrom.pm
+#
+# # thanks to BC for this tip
+ifplugin Mail::SpamAssassin::Plugin::ReceivedFrom
+header JM_RCVD_FROM eval:check_received_from()
+endif
+
Added: spamassassin/rules/trunk/sandbox/jm/ReceivedFrom.pm
URL: http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/jm/ReceivedFrom.pm?view=auto&rev=474547
==============================================================================
--- spamassassin/rules/trunk/sandbox/jm/ReceivedFrom.pm (added)
+++ spamassassin/rules/trunk/sandbox/jm/ReceivedFrom.pm Mon Nov 13 14:43:24 2006
@@ -0,0 +1,38 @@
+=head1 NAME
+
+Mail::SpamAssassin::Plugin::ReceivedFrom
+
+=head1 SYNOPSIS
+
+ loadplugin Mail::SpamAssassin::Plugin::ReceivedFrom [/path/to/ReceivedFrom.pm]
+
+=cut
+
+package Mail::SpamAssassin::Plugin::ReceivedFrom;
+
+use Mail::SpamAssassin::Plugin;
+use strict;
+use warnings;
+
+our @ISA = qw(Mail::SpamAssassin::Plugin);
+
+sub new {
+ my $class = shift;
+ my $mailsaobject = shift;
+ $class = ref($class) || $class;
+ my $self = $class->SUPER::new($mailsaobject);
+ bless ($self, $class);
+ $self->register_eval_rule("check_received_from");
+ return $self;
+}
+
+sub check_received_from {
+ my ($self, $pms) = @_;
+ my $from = $pms->get("From:addr");
+ $from =~ s/^.*\@//;
+ my $rcvd = $pms->get("Received");
+ return 1 if ($rcvd =~ /^from \Q${from}\E /m);
+ return 0;
+}
+
+1;