From b43f369dbe697065f236f050c60d1a2401502825 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 23 Mar 2013 01:42:10 -0400 Subject: [PATCH] headers: smite poorly behaved senders with -karma --- plugins/headers | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/headers b/plugins/headers index 959be55..deb5b70 100644 --- a/plugins/headers +++ b/plugins/headers @@ -133,6 +133,7 @@ sub hook_data_post { foreach my $h ( @required_headers ) { next if $header->get($h); + $self->adjust_karma( -1 ); return $self->get_reject( "We require a valid $h header", "no $h header"); }; @@ -140,11 +141,18 @@ sub hook_data_post { next if ! $header->get($h); # doesn't exist my @qty = $header->get($h); next if @qty == 1; # only 1 header - return $self->get_reject("Only one $h header allowed. See RFC 5322, Section 3.6", "too many $h headers"); + $self->adjust_karma( -1 ); + return $self->get_reject( + "Only one $h header allowed. See RFC 5322, Section 3.6", + "too many $h headers", + ); }; my $err_msg = $self->invalid_date_range(); - return $self->get_reject($err_msg, $err_msg) if $err_msg; + if ( $err_msg ) { + $self->adjust_karma( -1 ); + return $self->get_reject($err_msg, $err_msg); + }; $self->log( LOGINFO, 'pass' ); return (DECLINED);