spamassassin: added spam status to log messages

added additional values to tests, to suppress test warnings
This commit is contained in:
Matt Simerson 2012-05-11 01:50:08 -04:00 committed by Robert
parent c3d1f6b16e
commit 19927a117e
2 changed files with 8 additions and 5 deletions

View File

@ -375,18 +375,21 @@ sub check_spam_reject {
$self->log(LOGERROR, "skip: error getting spamassassin score");
return DECLINED;
};
my $ham_or_spam = $sa_results->{is_spam} eq 'Yes' ? 'Spam' : 'Ham';
my $reject = $self->{_args}{reject} or do {
$self->log(LOGERROR, "skip: reject threshold not set, default pass ($score)");
$self->log(LOGERROR, "skip: reject not set ($ham_or_spam, $score)");
return DECLINED;
};
if ( $score < $reject ) {
$self->log(LOGINFO, "pass, $score < $reject");
$self->log(LOGINFO, "pass, $ham_or_spam, $score < $reject");
return DECLINED;
};
# default of media_unsupported is DENY, so just change the message
$self->log(LOGINFO, "deny, $score > $reject");
$self->log(LOGINFO, "deny, $ham_or_spam, $score > $reject");
return Qpsmtpd::DSN->media_unsupported("spam score exceeded threshold");
}

View File

@ -82,13 +82,13 @@ sub test_check_spam_reject {
# message scored a 10, should pass
$self->{_args}{reject} = 12;
$transaction->notes('spamassassin', { score => 10 } );
$transaction->notes('spamassassin', { is_spam => 'Yes', score => 10 } );
my $r = $self->check_spam_reject($transaction);
cmp_ok( DECLINED, '==', $r, "check_spam_reject, $r");
# message scored a 15, should fail
$self->{_args}{reject} = 12;
$transaction->notes('spamassassin', { score => 15 } );
$transaction->notes('spamassassin', { is_spam => 'Yes', score => 15 } );
($r) = $self->check_spam_reject($transaction);
cmp_ok( DENY, '==', $r, "check_spam_reject, $r");
};