"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Mail/SpamAssassin/Plugin/TxRep.pm" between
Mail-SpamAssassin-3.4.4.tar.bz2 and Mail-SpamAssassin-3.4.5.tar.bz2

About: SpamAssassin is a mail filter that uses a wide range of heuristic tests on mail headers and body text to identify "spam" (also known as unsolicited commercial email) incl. Bayesian (statistical) spam filter and several internet-based realtime blacklists.

TxRep.pm  (Mail-SpamAssassin-3.4.4.tar.bz2):TxRep.pm  (Mail-SpamAssassin-3.4.5.tar.bz2)
skipping to change at line 184 skipping to change at line 184
The spamassassin/Plugin/TxRep.pm file replaces both spamassassin/Plugin/AWL.pm a nd The spamassassin/Plugin/TxRep.pm file replaces both spamassassin/Plugin/AWL.pm a nd
spamassassin/AutoWhitelist.pm. Another two AWL files, spamassassin/DBBasedAddrLi st.pm spamassassin/AutoWhitelist.pm. Another two AWL files, spamassassin/DBBasedAddrLi st.pm
and spamassassin/SQLBasedAddrList.pm are still needed. and spamassassin/SQLBasedAddrList.pm are still needed.
=head1 TEMPLATE TAGS =head1 TEMPLATE TAGS
This plugin module adds the following C<tags> that can be used as This plugin module adds the following C<tags> that can be used as
placeholders in certain options. See L<Mail::SpamAssassin::Conf> placeholders in certain options. See L<Mail::SpamAssassin::Conf>
for more information on TEMPLATE TAGS. for more information on TEMPLATE TAGS.
_TXREP_XXX_Y_ TXREP modifier _TXREPXXXY_ TXREP modifier
_TXREP_XXX_Y_MEAN_ Mean score on which TXREP modification is based _TXREPXXXYMEAN_ Mean score on which TXREP modification is based
_TXREP_XXX_Y_COUNT_ Number of messages on which TXREP modification is based _TXREPXXXYCOUNT_ Number of messages on which TXREP modification is based
_TXREP_XXX_Y_PRESCORE_ Score before TXREP _TXREPXXXYPRESCORE_ Score before TXREP
_TXREP_XXX_Y_UNKNOW_ New sender (not found in the TXREP list) _TXREPXXXYUNKNOWN_ New sender (not found in the TXREP list)
The XXX part of the tag takes the form of one of the following IDs, depending The XXX part of the tag takes the form of one of the following IDs, depending
on the reputation checked: EMAIL, EMAIL_IP, IP, DOMAIN, or HELO. The _Y appendix on the reputation checked: EMAIL, EMAILIP, IP, DOMAIN, or HELO. The Y appendix
ID is used only in the case of dual storage, and takes the form of either _U (fo ID is used only in the case of dual storage, and takes the form of either U (for
r user storage reputations), or G (for global storage reputations).
user storage reputations), or _G (for global storage reputations).
=cut =cut
package Mail::SpamAssassin::Plugin::TxRep; package Mail::SpamAssassin::Plugin::TxRep;
use strict; use strict;
use warnings; use warnings;
# use bytes; # use bytes;
use re 'taint'; use re 'taint';
skipping to change at line 1218 skipping to change at line 1218
} }
my $delta = 0; my $delta = 0;
my $timer = $self->{main}->time_method("total_txrep"); my $timer = $self->{main}->time_method("total_txrep");
my $msgscore = (defined $self->{learning})? $self->{learning} : $pms->get_auto learn_points(); my $msgscore = (defined $self->{learning})? $self->{learning} : $pms->get_auto learn_points();
my $date = $pms->{msg}->receive_date() || $pms->{date_header_time}; my $date = $pms->{msg}->receive_date() || $pms->{date_header_time};
my $msg_id = $self->{msgid} || my $msg_id = $self->{msgid} ||
Mail::SpamAssassin::Plugin::Bayes->get_msgid($pms->{msg}) || Mail::SpamAssassin::Plugin::Bayes->get_msgid($pms->{msg}) ||
$pms->get('Message-Id') || $pms->get('Message-ID') || $pms->get ('MESSAGE-ID') || $pms->get('MESSAGEID'); $pms->get('Message-Id') || $pms->get('Message-ID') || $pms->get ('MESSAGE-ID') || $pms->get('MESSAGEID');
my $from = lc $pms->get('From:addr') || $pms->get('EnvelopeFrom:addr');; my $from = lc $pms->get('From:addr') || $pms->get('EnvelopeFrom:addr');
return 0 unless $from =~ /\S/; return 0 unless $from =~ /\S/;
my $domain = $from; my $domain = $from;
$domain =~ s/^.+@//; $domain =~ s/^.+@//;
# Find the last untrusted relay and populate helo and original IP # Find the last untrusted relay and populate helo and original IP
my ($origip, $helo); my ($origip, $helo);
if (defined $pms->{relays_trusted} || defined $pms->{relays_untrusted}) { if (defined $pms->{relays_trusted} || defined $pms->{relays_untrusted}) {
my $trusteds = @{$pms->{relays_trusted}}; my $trusteds = @{$pms->{relays_trusted}};
foreach my $rly ( @{$pms->{relays_trusted}}, @{$pms->{relays_untrusted}} ) { foreach my $rly ( @{$pms->{relays_trusted}}, @{$pms->{relays_untrusted}} ) {
# Get the last found HELO, regardless of private/public or trusted/untrus ted # Get the last found HELO, regardless of private/public or trusted/untrus ted
skipping to change at line 1412 skipping to change at line 1412
if (defined $weight && $weight) { if (defined $weight && $weight) {
my $meanrep; my $meanrep;
my $timer = $self->{main}->time_method('check_txrep_'.lc($key)); my $timer = $self->{main}->time_method('check_txrep_'.lc($key));
if (defined $storage) { if (defined $storage) {
$self->{checker} = $self->{$storage}; $self->{checker} = $self->{$storage};
} }
my $found = $self->get_sender($id, $ip, $signedby); my $found = $self->get_sender($id, $ip, $signedby);
my $tag_id = (defined $storage)? uc($key.'_'.substr($storage,0,1)) : uc($key ); my $tag_id = (defined $storage)? uc($key.'_'.substr($storage,0,1)) : uc($key );
# TEMPLATE TAGS should match [A-Z] in their name
# and "_" must be avoided
$tag_id =~ s/_//g;
if (defined $found && $self->count()) { if (defined $found && $self->count()) {
$meanrep = $self->total() / $self->count(); $meanrep = $self->total() / $self->count();
} }
if ($self->{learning} && defined $msgscore) { if ($self->{learning} && defined $msgscore) {
if (defined $meanrep) { if (defined $meanrep) {
# $msgscore<=>0 gives the sign of $msgscore # $msgscore<=>0 gives the sign of $msgscore
$msgscore += ($msgscore<=>0) * abs($meanrep); $msgscore += ($msgscore<=>0) * abs($meanrep);
} }
dbg("TxRep: reputation: %s, count: %d, learning: %s, $tag_id: %s", dbg("TxRep: reputation: %s, count: %d, learning: %s, $tag_id: %s",
defined $meanrep? sprintf("%.3f",$meanrep) : 'none', defined $meanrep? sprintf("%.3f",$meanrep) : 'none',
skipping to change at line 1439 skipping to change at line 1442
$delta = $self->total() / $self->count(); $delta = $self->total() / $self->count();
$pms->set_tag('TXREP'.$tag_id, sprintf("%2.1f", $delta)) ; $pms->set_tag('TXREP'.$tag_id, sprintf("%2.1f", $delta)) ;
} elsif (defined $self->total()) { } elsif (defined $self->total()) {
#Bug 7164 - $msgscore undefined #Bug 7164 - $msgscore undefined
if (defined $msgscore) { if (defined $msgscore) {
$delta = ($self->total() + $msgscore) / (1 + $self->count()) - $ms gscore; $delta = ($self->total() + $msgscore) / (1 + $self->count()) - $ms gscore;
} else { } else {
$delta = ($self->total()) / (1 + $self->count()); $delta = ($self->total()) / (1 + $self->count());
} }
$pms->set_tag('TXREP_'.$tag_id, sprintf("%2.1f", $delta) ); $pms->set_tag('TXREP'.$tag_id, sprintf("%2.1f", $delta)) ;
if (defined $meanrep) { if (defined $meanrep) {
$pms->set_tag('TXREP_'.$tag_id.'_MEAN', sprintf("%2.1f", $meanre p)); $pms->set_tag('TXREP'.$tag_id.'MEAN', sprintf("%2.1f", $meanrep) );
} }
$pms->set_tag('TXREP_'.$tag_id.'_COUNT', sprintf("%2.1f", $self-> $pms->set_tag('TXREP'.$tag_id.'COUNT', sprintf("%2.1f", $self->co
count())); unt()));
$pms->set_tag('TXREP_'.$tag_id.'_PRESCORE', sprintf("%2.1f", $pms->{ $pms->set_tag('TXREP'.$tag_id.'PRESCORE', sprintf("%2.1f", $pms->{sc
score})); ore}));
} else { } else {
$pms->set_tag('TXREP_'.$tag_id.'_UNKNOWN', 1); $pms->set_tag('TXREP'.$tag_id.'UNKNOWN', 1);
} }
dbg("TxRep: reputation: %s, count: %d, weight: %.1f, delta: %.3f, $tag_i d: %s", dbg("TxRep: reputation: %s, count: %d, weight: %.1f, delta: %.3f, $tag_i d: %s",
defined $meanrep? sprintf("%.3f",$meanrep) : 'none', defined $meanrep? sprintf("%.3f",$meanrep) : 'none',
$self->count() || 0, $self->count() || 0,
$weight || 0, $weight || 0,
$delta || 0, $delta || 0,
$id || 'none' $id || 'none'
); );
} }
$timer = $self->{main}->time_method('update_txrep_'.lc($key)); $timer = $self->{main}->time_method('update_txrep_'.lc($key));
 End of changes. 8 change blocks. 
17 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)