Lines 170-175
Link Here
|
170 |
# happen in Conf.pm when we switch a rules from one priority to another |
170 |
# happen in Conf.pm when we switch a rules from one priority to another |
171 |
next unless ($self->{conf}->{priorities}->{$priority} > 0); |
171 |
next unless ($self->{conf}->{priorities}->{$priority} > 0); |
172 |
|
172 |
|
|
|
173 |
# if shortcircuiting is it, we skip all other priorities... |
174 |
last if (exists $self->{shortcircuit}); |
175 |
|
173 |
dbg("check: running tests for priority: $priority"); |
176 |
dbg("check: running tests for priority: $priority"); |
174 |
|
177 |
|
175 |
# only harvest the dnsbl queries once priority HARVEST_DNSBL_PRIORITY |
178 |
# only harvest the dnsbl queries once priority HARVEST_DNSBL_PRIORITY |
Lines 1613-1618
Link Here
|
1613 |
my ($self, $priority) = @_; |
1616 |
my ($self, $priority) = @_; |
1614 |
local ($_); |
1617 |
local ($_); |
1615 |
|
1618 |
|
|
|
1619 |
return if (exists $self->{shortcircuit}); |
1620 |
|
1616 |
# note: we do this only once for all head pattern tests. Only |
1621 |
# note: we do this only once for all head pattern tests. Only |
1617 |
# eval tests need to use stuff in here. |
1622 |
# eval tests need to use stuff in here. |
1618 |
$self->{test_log_msgs} = (); # clear test state |
1623 |
$self->{test_log_msgs} = (); # clear test state |
Lines 1639-1644
Link Here
|
1639 |
my $evalstr2 = ''; |
1644 |
my $evalstr2 = ''; |
1640 |
|
1645 |
|
1641 |
while (my($rulename, $rule) = each %{$self->{conf}{head_tests}->{$priority}}) { |
1646 |
while (my($rulename, $rule) = each %{$self->{conf}{head_tests}->{$priority}}) { |
|
|
1647 |
last if (exists $self->{shortcircuit}); |
1642 |
my $def = ''; |
1648 |
my $def = ''; |
1643 |
my ($hdrname, $testtype, $pat) = |
1649 |
my ($hdrname, $testtype, $pat) = |
1644 |
$rule =~ /^\s*(\S+)\s*(\=|\!)\~\s*(\S.*?\S)\s*$/; |
1650 |
$rule =~ /^\s*(\S+)\s*(\=|\!)\~\s*(\S.*?\S)\s*$/; |
Lines 1717-1722
Link Here
|
1717 |
my ($self, $priority, $textary) = @_; |
1723 |
my ($self, $priority, $textary) = @_; |
1718 |
local ($_); |
1724 |
local ($_); |
1719 |
|
1725 |
|
|
|
1726 |
return if (exists $self->{shortcircuit}); |
1727 |
|
1720 |
dbg("rules: running body-text per-line regexp tests; score so far=".$self->{score}); |
1728 |
dbg("rules: running body-text per-line regexp tests; score so far=".$self->{score}); |
1721 |
|
1729 |
|
1722 |
my $doing_user_rules = |
1730 |
my $doing_user_rules = |
Lines 1740-1745
Link Here
|
1740 |
my $evalstr2 = ''; |
1748 |
my $evalstr2 = ''; |
1741 |
|
1749 |
|
1742 |
while (my($rulename, $pat) = each %{$self->{conf}{body_tests}->{$priority}}) { |
1750 |
while (my($rulename, $pat) = each %{$self->{conf}{body_tests}->{$priority}}) { |
|
|
1751 |
last if (exists $self->{shortcircuit}); |
1743 |
$evalstr .= ' |
1752 |
$evalstr .= ' |
1744 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
1753 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
1745 |
# call procedurally as it is faster. |
1754 |
# call procedurally as it is faster. |
Lines 2129-2134
Link Here
|
2129 |
my ($self, $priority, @uris) = @_; |
2138 |
my ($self, $priority, @uris) = @_; |
2130 |
local ($_); |
2139 |
local ($_); |
2131 |
|
2140 |
|
|
|
2141 |
return if (exists $self->{shortcircuit}); |
2142 |
|
2132 |
dbg("uri: running uri tests; score so far=".$self->{score}); |
2143 |
dbg("uri: running uri tests; score so far=".$self->{score}); |
2133 |
|
2144 |
|
2134 |
my $doing_user_rules = |
2145 |
my $doing_user_rules = |
Lines 2152-2157
Link Here
|
2152 |
my $evalstr2 = ''; |
2163 |
my $evalstr2 = ''; |
2153 |
|
2164 |
|
2154 |
while (my($rulename, $pat) = each %{$self->{conf}{uri_tests}->{$priority}}) { |
2165 |
while (my($rulename, $pat) = each %{$self->{conf}{uri_tests}->{$priority}}) { |
|
|
2166 |
last if (exists $self->{shortcircuit}); |
2167 |
|
2155 |
$evalstr .= ' |
2168 |
$evalstr .= ' |
2156 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
2169 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
2157 |
'.$rulename.'_uri_test($self, @_); # call procedurally for speed |
2170 |
'.$rulename.'_uri_test($self, @_); # call procedurally for speed |
Lines 2218-2223
Link Here
|
2218 |
my ($self, $priority, $textary) = @_; |
2231 |
my ($self, $priority, $textary) = @_; |
2219 |
local ($_); |
2232 |
local ($_); |
2220 |
|
2233 |
|
|
|
2234 |
return if (exists $self->{shortcircuit}); |
2235 |
|
2221 |
dbg("rules: running raw-body-text per-line regexp tests; score so far=".$self->{score}); |
2236 |
dbg("rules: running raw-body-text per-line regexp tests; score so far=".$self->{score}); |
2222 |
|
2237 |
|
2223 |
my $doing_user_rules = |
2238 |
my $doing_user_rules = |
Lines 2241-2246
Link Here
|
2241 |
my $evalstr2 = ''; |
2256 |
my $evalstr2 = ''; |
2242 |
|
2257 |
|
2243 |
while (my($rulename, $pat) = each %{$self->{conf}{rawbody_tests}->{$priority}}) { |
2258 |
while (my($rulename, $pat) = each %{$self->{conf}{rawbody_tests}->{$priority}}) { |
|
|
2259 |
last if (exists $self->{shortcircuit}); |
2244 |
$evalstr .= ' |
2260 |
$evalstr .= ' |
2245 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
2261 |
if ($self->{conf}->{scores}->{q{'.$rulename.'}}) { |
2246 |
'.$rulename.'_rawbody_test($self, @_); # call procedurally for speed |
2262 |
'.$rulename.'_rawbody_test($self, @_); # call procedurally for speed |
Lines 2405-2410
Link Here
|
2405 |
my ($self, $priority) = @_; |
2421 |
my ($self, $priority) = @_; |
2406 |
local ($_); |
2422 |
local ($_); |
2407 |
|
2423 |
|
|
|
2424 |
return if (exists $self->{shortcircuit}); |
2425 |
|
2408 |
dbg("rules: running meta tests; score so far=" . $self->{score} ); |
2426 |
dbg("rules: running meta tests; score so far=" . $self->{score} ); |
2409 |
|
2427 |
|
2410 |
my $doing_user_rules = |
2428 |
my $doing_user_rules = |
Lines 2431-2436
Link Here
|
2431 |
|
2449 |
|
2432 |
# Go through each rule and figure out what we need to do |
2450 |
# Go through each rule and figure out what we need to do |
2433 |
foreach $rulename (@metas) { |
2451 |
foreach $rulename (@metas) { |
|
|
2452 |
last if (exists $self->{shortcircuit}); |
2434 |
my $rule = $self->{conf}->{meta_tests}->{$priority}->{$rulename}; |
2453 |
my $rule = $self->{conf}->{meta_tests}->{$priority}->{$rulename}; |
2435 |
my $token; |
2454 |
my $token; |
2436 |
|
2455 |
|
Lines 2545-2556
Link Here
|
2545 |
sub run_eval_tests { |
2564 |
sub run_eval_tests { |
2546 |
my ($self, $evalhash, $prepend2desc, @extraevalargs) = @_; |
2565 |
my ($self, $evalhash, $prepend2desc, @extraevalargs) = @_; |
2547 |
local ($_); |
2566 |
local ($_); |
|
|
2567 |
|
2568 |
return if (exists $self->{shortcircuit}); |
2548 |
|
2569 |
|
2549 |
my $debugenabled = would_log('dbg'); |
2570 |
my $debugenabled = would_log('dbg'); |
2550 |
|
2571 |
|
2551 |
my $scoreset = $self->{conf}->get_score_set(); |
2572 |
my $scoreset = $self->{conf}->get_score_set(); |
2552 |
while (my ($rulename, $test) = each %{$evalhash}) { |
2573 |
while (my ($rulename, $test) = each %{$evalhash}) { |
2553 |
|
2574 |
|
|
|
2575 |
last if (exists $self->{shortcircuit}); |
2576 |
|
2554 |
# Score of 0, skip it. |
2577 |
# Score of 0, skip it. |
2555 |
next unless ($self->{conf}->{scores}->{$rulename}); |
2578 |
next unless ($self->{conf}->{scores}->{$rulename}); |
2556 |
|
2579 |
|
Lines 2753-2758
Link Here
|
2753 |
|
2776 |
|
2754 |
my $score = $self->{conf}->{scores}->{$rule}; |
2777 |
my $score = $self->{conf}->{scores}->{$rule}; |
2755 |
|
2778 |
|
|
|
2779 |
my $sc = $self->{conf}->{shortcircuit}; |
2780 |
if (defined $sc->{$rule}) { |
2781 |
$self->{shortcircuit} = $rule; |
2782 |
if ($sc->{$rule} =~ m/spam/) { |
2783 |
$score = $self->{conf}->{shortcircuit_spam_score}; |
2784 |
} |
2785 |
elsif ($sc->{$rule} =~ m/ham/) { |
2786 |
$score = $self->{conf}->{shortcircuit_ham_score}; |
2787 |
} |
2788 |
dbg("shortcircuit: hit on rule $rule, sc type is " . $sc->{$rule} . ", apply score of $score"); |
2789 |
} |
2790 |
|
2756 |
$self->_handle_hit($rule, $score, $area, $desc); |
2791 |
$self->_handle_hit($rule, $score, $area, $desc); |
2757 |
} |
2792 |
} |
2758 |
|
2793 |
|