dkim: reduce INFO logging to once per connect

This commit is contained in:
Matt Simerson 2013-04-21 19:54:06 -04:00
parent a14de07280
commit 8e054c1eda

View File

@ -353,7 +353,7 @@ sub handle_sig_pass {
elsif ($prs->{neutral}) { elsif ($prs->{neutral}) {
$self->add_header($mess); $self->add_header($mess);
$self->log(LOGINFO, "pass, valid signature, neutral policy"); $self->log(LOGINFO, "pass, valid signature, neutral policy");
$self->log(LOGINFO, $mess); $self->log(LOGDEBUG, $mess);
return DECLINED; return DECLINED;
} }
elsif ($prs->{reject}) { elsif ($prs->{reject}) {
@ -364,7 +364,7 @@ sub handle_sig_pass {
"fail, valid sig, reject policy"); "fail, valid sig, reject policy");
} }
# this should never happen # this should never happen,
$self->add_header($mess); $self->add_header($mess);
$self->log(LOGERROR, "pass, valid sig, no policy results"); $self->log(LOGERROR, "pass, valid sig, no policy results");
$self->log(LOGINFO, $mess); $self->log(LOGINFO, $mess);
@ -449,14 +449,17 @@ sub get_keydir {
sub save_signatures_to_note { sub save_signatures_to_note {
my ($self, $dkim) = @_; my ($self, $dkim) = @_;
my %domains;
foreach my $sig ($dkim->signatures) { foreach my $sig ($dkim->signatures) {
next if $sig->result ne 'pass'; next if $sig->result ne 'pass';
my $doms = $self->connection->notes('dkim_pass_domains') || []; $domains{$sig->domain} = 1;
next if grep /$sig->domain/, @$doms; # already in the list
push @$doms, $sig->domain;
$self->connection->notes('dkim_pass_domains', $doms);
$self->log(LOGINFO, "info, added " . $sig->domain);
} }
return if 0 == scalar keys %domains;
my $doms = $self->connection->notes('dkim_pass_domains') || [];
push @$doms, keys %domains;
$self->log(LOGDEBUG, "info, signed by: ". join(',', keys %domains) );
$self->connection->notes('dkim_pass_domains', $doms);
} }
sub send_message_to_dkim { sub send_message_to_dkim {