domainkeys: add header at top of headers (not bottom)

This commit is contained in:
Matt Simerson 2012-06-25 02:41:43 -04:00
parent 96dd90f808
commit d2cd1160ad

View File

@ -86,7 +86,7 @@ sub data_post_handler {
return DECLINED if $self->is_immune(); return DECLINED if $self->is_immune();
if ( ! $transaction->header->get('DomainKey-Signature') ) { if ( ! $transaction->header->get('DomainKey-Signature') ) {
$self->log(LOGINFO, "skip: unsigned"); $self->log(LOGINFO, "skip, unsigned");
return DECLINED; return DECLINED;
}; };
@ -95,28 +95,28 @@ sub data_post_handler {
my $message = load Mail::DomainKeys::Message( my $message = load Mail::DomainKeys::Message(
HeadString => $transaction->header->as_string, HeadString => $transaction->header->as_string,
BodyReference => $body) or do { BodyReference => $body) or do {
$self->log(LOGWARN, "skip: unable to load message"), $self->log(LOGWARN, "skip, unable to load message"),
return DECLINED; return DECLINED;
}; };
# no sender domain means no verification # no sender domain means no verification
if ( ! $message->senderdomain ) { if ( ! $message->senderdomain ) {
$self->log(LOGINFO, "skip: failed to parse sender domain"), $self->log(LOGINFO, "skip, failed to parse sender domain"),
return DECLINED; return DECLINED;
}; };
my $status = $self->get_message_status( $message ); my $status = $self->get_message_status( $message );
if ( defined $status ) { if ( defined $status ) {
$transaction->header->replace("DomainKey-Status", $status); $transaction->header->add("DomainKey-Status", $status, 0);
$self->log(LOGINFO, "pass: $status"); $self->log(LOGINFO, "pass, $status");
return DECLINED; return DECLINED;
}; };
$self->log(LOGERROR, "fail: signature failed to verify"); $self->log(LOGERROR, "fail, signature invalid");
return DECLINED if ! $self->{reject}; return DECLINED if ! $self->{reject};
my $deny = $self->{reject_type} eq 'temp' ? DENYSOFT : DENY; my $deny = $self->{reject_type} eq 'temp' ? DENYSOFT : DENY;
return ($deny, "DomainKeys signature failed to verify"); return ($deny, "DomainKeys signature validation failed");
} }
sub get_message_status { sub get_message_status {