From f9fb0acee7ec39bfdfd22110b72904300c488ce5 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 22 Apr 2013 02:29:29 -0400 Subject: [PATCH] qmail_deliverable: smite null sender to email list --- plugins/karma | 18 ++++++++++++++---- plugins/qmail_deliverable | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/plugins/karma b/plugins/karma index 8cc91e6..a32ed6a 100644 --- a/plugins/karma +++ b/plugins/karma @@ -328,8 +328,11 @@ sub rcpt_handler { my $recipients = scalar $self->transaction->recipients; return DECLINED if $recipients < 2; # only one recipient - my $karma = $self->connection->notes('karma_history'); - return DECLINED if $karma > 0; # good karma, no limit + my $history = $self->connection->notes('karma_history'); + return DECLINED if $history > 0; # good history, no limit + + my $karma = $self->connection->notes('karma'); + return DECLINED if $karma > 0; # good connection, no limit # limit # of recipients if host has negative or unknown karma return $self->get_reject("too many recipients"); @@ -337,9 +340,16 @@ sub rcpt_handler { sub data_handler { my ($self, $transaction) = @_; - return DECLINED if !$self->qp->connection->relay_client; - $self->adjust_karma(5); # big karma boost for authenticated user/IP + if ( $self->qp->connection->relay_client ) { + $self->adjust_karma(5); # big karma boost for authenticated user/IP + }; + + my $karma = $self->connection->notes('karma'); + if ( $karma < -3 ) { # bad karma + return $self->get_reject("very bad karma: $karma"); + }; + return DECLINED; } diff --git a/plugins/qmail_deliverable b/plugins/qmail_deliverable index 62609f8..2b31756 100644 --- a/plugins/qmail_deliverable +++ b/plugins/qmail_deliverable @@ -201,8 +201,10 @@ sub rcpt_handler { $self->log(LOGINFO, "pass, bouncesaying with program"), $k++ if $rv == 0x13; if ($rv == 0x14) { my $s = $transaction->sender->address; - return (DENY, "mailing lists do not accept null senders") - if (!$s || $s eq '<>'); + if (!$s || $s eq '<>') { + $self->adjust_karma(-1); + return (DENY, "mailing lists do not accept null senders"); + }; $self->log(LOGINFO, "pass, ezmlm list"); $k++; }