headers: smite poorly behaved senders with -karma

This commit is contained in:
Matt Simerson 2013-03-23 01:42:10 -04:00
parent 279a43f26a
commit e01843f6f9

View File

@ -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);