Merge pull request #171 from priyadi/authresultfix

Authentication-Results header fix on data_post
This commit is contained in:
Matt Simerson 2014-12-30 13:58:21 -08:00
commit a515e2b17c
6 changed files with 33 additions and 7 deletions

View File

@ -339,10 +339,35 @@ Arguments:
__FIXME:__ check arguments __FIXME:__ check arguments
## hook\_data\_post\_headers
The `data_post_headers` is called after the client sent the final `.\r\n`
of a message. This is meant for plugins that modify headers before the message
is processed by `data_post` phase below.
Allowed return codes are
- DENY
Return a hard failure code
- DENYSOFT
Return a soft failure code
- DENY\_DISCONNECT / DENYSOFT\_DISCONNECT
as above but with disconnect
Example plugin is `dkim`, `domainkeys`, `dmarc`.
## hook\_data\_post ## hook\_data\_post
The `data_post` hook is called after the client sent the final `.\r\n` The `data_post` hook is called after all headers has been added in
of a message, before the mail is sent to the queue. `data_post_headers` above. This is meant for plugins that expects complete
messages, such as content analyzing spam filters. Plugins can still add
headers in this hook, however it is recommended only informational headers
are added here.
Allowed return codes are Allowed return codes are
@ -372,7 +397,7 @@ Arguments:
my ($self, $transaction) = @_; my ($self, $transaction) = @_;
Example plugins: `spamassassin`, `virus/clamdscan` Example plugins: `spamassassin`, `virus/clamdscan`, `dspam`
## hook\_queue\_pre ## hook\_queue\_pre

View File

@ -12,7 +12,7 @@ our @hooks = qw(
logging config user_config post-fork pre-connection connect ehlo_parse ehlo logging config user_config post-fork pre-connection connect ehlo_parse ehlo
helo_parse helo auth_parse auth auth-plain auth-login auth-cram-md5 helo_parse helo auth_parse auth auth-plain auth-login auth-cram-md5
rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre
data data_headers_end data_post queue_pre queue queue_post vrfy noop data data_headers_end data_post_headers data_post queue_pre queue queue_post vrfy noop
quit reset_transaction disconnect post-connection quit reset_transaction disconnect post-connection
unrecognized_command deny ok received_line help unrecognized_command deny ok received_line help
); );

View File

@ -781,6 +781,7 @@ sub data_respond {
return 1; return 1;
} }
$self->run_hooks("data_post_headers");
$self->authentication_results(); $self->authentication_results();
$self->received_line(); $self->received_line();
$self->run_hooks("data_post"); $self->run_hooks("data_post");

View File

@ -191,7 +191,7 @@ sub register {
} }
} }
$self->register_hook('data_post', 'data_post_handler'); $self->register_hook('data_post_headers', 'data_post_handler');
} }
sub data_post_handler { sub data_post_handler {

View File

@ -91,7 +91,7 @@ sub register {
} }
else { else {
$self->{_dmarc} = Mail::DMARC::PurePerl->new(); $self->{_dmarc} = Mail::DMARC::PurePerl->new();
$self->register_hook('data_post', 'data_post_handler'); $self->register_hook('data_post_headers', 'data_post_handler');
}; };
} }

View File

@ -83,7 +83,7 @@ sub register {
} }
} }
$self->register_hook('data_post', 'data_post_handler'); $self->register_hook('data_post_headers', 'data_post_handler');
} }
sub data_post_handler { sub data_post_handler {