From 9c095ab2780746d9740c42a3fcd4a319bb346e3c Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 29 Apr 2013 23:49:22 -0400 Subject: [PATCH] is_naughty is a setter now too --- lib/Qpsmtpd/Plugin.pm | 7 ++++++- plugins/dnsbl | 2 +- plugins/dspam | 6 ++---- plugins/virus/clamdscan | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index a72cc86..026ffc3 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -307,7 +307,12 @@ sub is_immune { } sub is_naughty { - my $self = shift; + my ($self, $setit) = @_; + + if ( defined $setit ) { + $self->connection->notes('naughty', $setit); + $self->connection->notes('rejected', $setit); + }; if ($self->connection->notes('naughty')) { diff --git a/plugins/dnsbl b/plugins/dnsbl index 4f48270..a7b11b6 100644 --- a/plugins/dnsbl +++ b/plugins/dnsbl @@ -294,7 +294,7 @@ sub hook_rcpt { "skip, don't blacklist special account: " . $rcpt->user); # clear the naughty connection note here, if desired. - $self->connection->notes('naughty', 0); + $self->is_naughty(0); } return DECLINED; diff --git a/plugins/dspam b/plugins/dspam index 39849a9..e9f8be6 100644 --- a/plugins/dspam +++ b/plugins/dspam @@ -661,9 +661,7 @@ sub autolearn_naughty { return; } - if ( $self->connection->notes('naughty') - && $response->{result} eq 'Innocent') - { + if ( $self->is_naughty() && $response->{result} eq 'Innocent') { $self->log(LOGINFO, "training naughty FN message as spam"); $self->train_error_as_spam($transaction); return 1; @@ -707,7 +705,7 @@ sub autolearn_spamassassin { my $sa = $transaction->notes('spamassassin'); if (!$sa || !$sa->{is_spam}) { - if (!$self->connection->notes('naughty')) { + if (!$self->is_naughty()) { $self->log(LOGERROR, "SA results missing"); # SA skips naughty } return; diff --git a/plugins/virus/clamdscan b/plugins/virus/clamdscan index 246cb1e..2928665 100644 --- a/plugins/virus/clamdscan +++ b/plugins/virus/clamdscan @@ -92,8 +92,8 @@ adjusted for ClamAV::Client by Devin Carraway . =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005 John Peacock, -Copyright (c) 2007 Devin Carraway + Copyright (c) 2005 John Peacock, + Copyright (c) 2007 Devin Carraway Based heavily on the clamav plugin @@ -167,7 +167,7 @@ sub data_post_handler { if ($found) { $self->log(LOGNOTICE, "fail, found virus $found"); - $self->connection->notes('naughty', 1); # see plugins/naughty + $self->is_naughty(1); # see plugins/naughty $self->adjust_karma(-1); if ($self->{_args}{deny_viruses}) {