On Sat, Mar 23, 2002 at 02:16:24PM -0800, [EMAIL PROTECTED] wrote:
> http://www.hughes-family.org/bugzilla/show_bug.cgi?id=120
> 
>            Summary: No subject yields "All caps" test result
>            Product: Spamassassin
>            Version: 2.11
>           Platform: PC
>         OS/Version: Linux
>             Status: NEW
>           Severity: minor
>           Priority: P3
>          Component: Rules
>         AssignedTo: [EMAIL PROTECTED]
>         ReportedBy: [EMAIL PROTECTED]
> 
> 
> When a message is received with no subject, it is marked as an "All caps" 
> subject message, and assigned 2 points.  Ideally, there should be a separate 
> test for "no subject" with a slightly lower point value, and the all caps test 
> shouldn't catch no-subject messages.

Here's an idea to fix this bug:

Index: lib/Mail/SpamAssassin/EvalTests.pm
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/EvalTests.pm,v
retrieving revision 1.111
diff -u -r1.111 EvalTests.pm
--- lib/Mail/SpamAssassin/EvalTests.pm  17 Mar 2002 11:28:42 -0000      1.111
+++ lib/Mail/SpamAssassin/EvalTests.pm  24 Mar 2002 16:57:29 -0000
@@ -870,8 +870,18 @@
 sub subject_is_all_caps {
    my ($self) = @_;
    my $subject = $self->get('Subject');
+
+   return 0 if subject_missing($self);
+
    $subject =~ s/[^a-zA-Z]//;
    return $subject eq uc($subject);
+}
+
+sub subject_missing {
+   my ($self) = @_;
+   my $subject = $self->get('Subject');
+   chomp($subject);
+   return length($subject) ? 0 : 1;
 }
 
 ###########################################################################
Index: rules/20_head_tests.cf
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/rules/20_head_tests.cf,v
retrieving revision 1.39
diff -u -r1.39 20_head_tests.cf
--- rules/20_head_tests.cf      22 Mar 2002 16:23:59 -0000      1.39
+++ rules/20_head_tests.cf      24 Mar 2002 16:57:29 -0000
@@ -50,6 +50,9 @@
 header SUBJ_ALL_CAPS           eval:subject_is_all_caps()
 describe SUBJ_ALL_CAPS         Subject is all capitals
 
+header SUBJ_MISSING            eval:subject_missing()
+describe SUBJ_MISSING          Subject: is empty or missing
+
 # (allow this test to pass if there's no Message-Id header)
 header MSGID_HAS_NO_AT         Message-Id !~ /\@/ [if-unset: NO@MSGID]
 describe MSGID_HAS_NO_AT       Message-Id has no @ sign
Index: rules/50_scores.cf
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/rules/50_scores.cf,v
retrieving revision 1.47
diff -u -r1.47 50_scores.cf
--- rules/50_scores.cf  22 Mar 2002 16:23:59 -0000      1.47
+++ rules/50_scores.cf  24 Mar 2002 16:57:29 -0000
@@ -234,6 +234,7 @@
 score SUBJ_HAS_Q_MARK                1.315
 score SUBJ_HAS_SPACES                2.469
 score SUBJ_HAS_UNIQ_ID               2.321
+score SUBJ_MISSING                   0.110
 score SUBJ_REMOVE                    -0.471
 score SUPERLONG_LINE                 0.661
 score SUSPICIOUS_CC_RECIPS           -0.321

_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to