| 1 | package Mail::Milter::Authentication::Handler::DKIM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 44 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 44 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 44 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 44 | ▶ | use Mail::Milter::Authentication::Pragmas; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Handler class for DKIM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 44 | our $VERSION = '4.20261116'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 44 | ▶ | use base 'Mail::Milter::Authentication::Handler'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 44 | ▶ | use Mail::DKIM 1.20200824; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 44 | ▶ | use Mail::DKIM::DNS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 44 | ▶ | use Mail::DKIM::KeyValueList; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 44 | ▶ | use Mail::DKIM::Verifier; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | sub default_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_config: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | 'hide_none' => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 'hide_domainkeys' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 'check_adsp' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 'show_default_adsp' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 'adsp_hide_none' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 'extra_properties' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 'no_strict' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 'early_lookup_limit' => 10, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | sub grafana_rows { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grafana_rows: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | my @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | push @rows, $self->get_json( 'DKIM_metrics' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | return \@rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 76 | ▶ | sub register_metrics { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_metrics: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 76 | 'dkim_total' => 'The number of emails processed for DKIM', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'dkim_signatures' => 'The number of signatures processed for DKIM', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 257 | ▶ | sub envfrom_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
envfrom_callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 257 | my ( $self, $env_from ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 257 | $self->{'failmode'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 257 | $self->{'headers'} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 257 | $self->{'has_dkim'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 257 | $self->{'valid_domains'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 257 | $self->{'early_lookups'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 257 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 257 | $self->destroy_object('dkim'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 36 | ▶ | sub show_domainkeys { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show_domainkeys: called CC=3 SCAR=15.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 36 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 36 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 36 | ▶ | return 1 if ! exists $config->{'hide_domainkeys'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | return 0 if $config->{'hide_domainkeys'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1816 | ▶ | sub header_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_callback: called CC=13 SCAR=26.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1816 | my ( $self, $header, $value, $original ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1816 | ▶ | return if ( $self->{'failmode'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1816 | my $EOL = "\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1816 | my $dkim_chunk = $original . $EOL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1816 | $dkim_chunk =~ s/\015?\012/$EOL/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1816 | push @{$self->{'headers'}} , $dkim_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1816 | ▶ | if ( lc($header) eq 'dkim-signature' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 258 | $self->{'has_dkim'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 258 | my $parsed = eval{ Mail::DKIM::KeyValueList->parse( $value ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 258 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 258 | ▶ | if ( $parsed ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 258 | my $domain = $parsed->get_tag('d'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 258 | my $selector = $parsed->get_tag('s'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 258 | ▶ | if ( defined $selector && defined $domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $selector and defined $domain
MC/DC0%0/2
defined $selector and defined $domain
defined $selector
defined $domain
Truth table33%1/3
A and B
A= defined $selectorB= defined $domain
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 258 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 258 | ▶ | my $lookup_limit = $config->{'early_lookup_limit'} // 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$config->{"early_lookup_limit"} // 10
MC/DC100%1/1
$config->{"early_lookup_limit"} // 10
$config->{"early_lookup_limit"}
Truth table100%2/2
A
A= $config->{"early_lookup_limit"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 258 | my @lookups = ( $selector.'._domainkey.'.$domain ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 258 | ▶ | push @lookups, '_adsp._domainkey.'.$domain if $config->{'check_adsp'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 258 | my $resolver = $self->get_object('resolver'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | LOOKUP: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 258 | foreach my $lookup ( @lookups ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 318 | ▶ | next LOOKUP if $self->{'early_lookups'}->{ lc $lookup }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 299 | ▶ | last LOOKUP if scalar keys $self->{'early_lookups'}->%* >= $lookup_limit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 237 | $self->{'early_lookups'}->{ lc $lookup } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 237 | eval{ $resolver->bgsend( $lookup, 'TXT' ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 237 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 237 | $self->dbgout( 'DNSEarlyLookup', "$lookup TXT", LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1816 | ▶ | if ( lc($header) eq 'domainkey-signature' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $self->{'has_dkim'} = 1 if $self->show_domainkeys(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 250 | ▶ | sub eoh_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eoh_callback: called CC=7 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 250 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 250 | ▶ | return if ( $self->{'failmode'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 250 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 250 | ▶ | if ( $self->{'has_dkim'} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 115 | $self->metric_count( 'dkim_total', { 'result' => 'none' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 115 | $self->dbgout( 'DKIMResult', 'No DKIM headers', LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 115 | ▶ | if ( !( $config->{'hide_none'} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 108 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( 'none' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 108 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'no signatures found' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 108 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 115 | delete $self->{'headers'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 135 | my $dkim; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 135 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 135 | my $UseStrict = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 135 | ▶ | if ( $config->{ 'no_strict' } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | $UseStrict = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 135 | $dkim = Mail::DKIM::Verifier->new( 'Strict' => $UseStrict ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 135 | my $resolver = $self->get_object('resolver'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 135 | Mail::DKIM::DNS::resolver($resolver); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 135 | $self->set_object('dkim', $dkim, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 135 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $self->log_error( 'DKIM Setup Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->metric_count( 'dkim_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | delete $self->{'headers'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 135 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $dkim->PRINT( join q{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 135 | @{ $self->{'headers'} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | "\015\012", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 135 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $self->log_error( 'DKIM Headers Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $self->metric_count( 'dkim_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 135 | delete $self->{'headers'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 250 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 248 | ▶ | sub body_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
body_callback: called CC=6 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 248 | my ( $self, $body_chunk ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 248 | ▶ | return if ( $self->{'failmode'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 248 | ▶ | return if ( $self->{'has_dkim'} == 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 135 | my $EOL = "\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 135 | my $dkim_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 135 | ▶ | if ( $self->{'carry'} ne q{} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $dkim_chunk = $self->{'carry'} . $body_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 135 | $dkim_chunk = $body_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 135 | ▶ | if ( substr( $dkim_chunk, -1 ) eq "\015" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $self->{'carry'} = "\015"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $dkim_chunk = substr( $dkim_chunk, 0, -1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 135 | $dkim_chunk =~ s/\015?\012/$EOL/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 135 | my $dkim = $self->get_object('dkim'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 135 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 135 | $dkim->PRINT( $dkim_chunk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 135 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->log_error( 'DKIM Body Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->metric_count( 'dkim_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 250 | ▶ | sub eom_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eom_callback: called CC=61 SCAR=50.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 250 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 250 | ▶ | return if ( $self->{'has_dkim'} == 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 135 | ▶ | return if ( $self->{'failmode'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 135 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 135 | my $dkim = $self->get_object('dkim'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 135 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 135 | $dkim->PRINT( $self->{'carry'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 135 | $dkim->CLOSE(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 135 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 135 | my $dkim_result = $dkim->result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 135 | my $dkim_result_detail = $dkim->result_detail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 135 | $self->metric_count( 'dkim_total', { 'result' => $dkim_result } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 135 | $self->dbgout( 'DKIMResult', $dkim_result_detail, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 135 | ▶ | if ( !$dkim->signatures() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ( !( $config->{'hide_none'} && $dkim_result eq 'none' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$config->{"hide_none"} and $dkim_result eq "none"
MC/DC0%0/2
$config->{"hide_none"} and $dkim_result eq "none"
$config->{"hide_none"}
$dkim_result eq "none"
Truth table0%0/3
A and B
A= $config->{"hide_none"}B= $dkim_result eq "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( $dkim_result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'no signatures found' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 135 | foreach my $signature ( $dkim->signatures() ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 167 | my $otype = ref $signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 167 | ▶ | my $type = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | $otype eq 'Mail::DKIM::DkSignature' ? 'domainkeys' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | : $otype eq 'Mail::DKIM::Signature' ? 'dkim' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | : 'dkim'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 167 | $self->dbgout( 'DKIMSignatureType', $type, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 167 | $self->dbgout( 'DKIMSignatureDomain', $signature->domain, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 167 | $self->dbgout( 'DKIMSignatureIdentity', $signature->identity, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 167 | $self->dbgout( 'DKIMSignatureResult', $signature->result_detail, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 167 | my $signature_result = $signature->result(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 167 | my $signature_result_detail = $signature->result_detail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 167 | ▶ | if ( $signature_result eq 'pass' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 101 | $self->{'valid_domains'}->{ lc $signature->domain } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 167 | ▶ | if ( $signature_result eq 'invalid' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 25 | ▶ | if ( $signature_result_detail =~ /DNS query timeout for (.*) at / ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $timeout_domain = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->log_error( "TIMEOUT DETECTED: in DKIM result: $timeout_domain" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $signature_result_detail = "DNS query timeout for $timeout_domain"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 167 | my $result_comment = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 167 | ▶ | if ( $signature_result ne 'pass' and $signature_result ne 'none' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$signature_result ne "pass" and $signature_result ne "none"
MC/DC50%1/2
$signature_result ne "pass" and $signature_result ne "none"
$signature_result ne "pass"
$signature_result ne "none"
Truth table66%2/3
A and B
A= $signature_result ne "pass"B= $signature_result ne "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 66 | $signature_result_detail =~ /$signature_result \((.*)\)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 66 | ▶ | if ( $1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 66 | $result_comment = $1 . ', '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 167 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$config->{"hide_none"} and $signature_result eq "none"
MC/DC0%0/2
$config->{"hide_none"} and $signature_result eq "none"
$config->{"hide_none"}
$signature_result eq "none"
Truth table66%2/3
A and B
A= $config->{"hide_none"}B= $signature_result eq "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | !( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | $config->{'hide_none'} && $signature_result eq 'none' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 167 | ▶ | my $selector = eval{ $signature->selector } // q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$signature->selector
}
} // ""
MC/DC0%0/1
eval {
do {
$signature->selector
}
} // ""
eval {
do {
$signature->selector
}
}
Truth table50%1/2
A
A= eval {
do {
$signature->selector
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 167 | my $key = eval {$signature->get_public_key()}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 167 | ▶ | my $key_type = eval{ $key->type() } // 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
eval {
do {
$key->type
}
} // "unknown"
MC/DC100%1/1
eval {
do {
$key->type
}
} // "unknown"
eval {
do {
$key->type
}
}
Truth table100%2/2
A
A= eval {
do {
$key->type
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # Key size for ed25519 does not make sense | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 167 | ▶ | my $key_size = $key_type eq 'rsa' ? ( eval{ $key->size() } // 0 ) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
eval {
do {
$key->size
}
} // 0
MC/DC0%0/1
eval {
do {
$key->size
}
} // 0
eval {
do {
$key->size
}
}
Truth table50%1/2
A
A= eval {
do {
$key->size
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 167 | ▶ | my $hash_algorithm = eval { $signature->hash_algorithm(); } // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$signature->hash_algorithm
}
} // ""
MC/DC0%0/1
eval {
do {
$signature->hash_algorithm
}
} // ""
eval {
do {
$signature->hash_algorithm
}
}
Truth table50%1/2
A
A= eval {
do {
$signature->hash_algorithm
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 167 | ▶ | my $canonicalization = eval { $signature->canonicalization(); } // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$signature->canonicalization
}
} // ""
MC/DC0%0/1
eval {
do {
$signature->canonicalization
}
} // ""
eval {
do {
$signature->canonicalization
}
}
Truth table50%1/2
A
A= eval {
do {
$signature->canonicalization
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 167 | my @key_data_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 167 | ▶ | push @key_data_parts, $key_size . '-bit' if $key_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 167 | push @key_data_parts, "$key_type key"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 167 | ▶ | push @key_data_parts, $hash_algorithm if $hash_algorithm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 167 | my $key_data = join ' ', @key_data_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 167 | $self->metric_count( 'dkim_signatures', { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 'type' => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 'result' => $signature_result, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 'key_size' => $key_size, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 'key_type' => $key_type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 'hash_algorithm' => $hash_algorithm, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 'canonicalization' => $canonicalization, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 167 | ▶ | if ( $type eq 'domainkeys' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | if ( $self->show_domainkeys() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( $type )->safe_set_value( $signature_result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( $result_comment . $key_data ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.d' )->safe_set_value( $signature->domain() ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.b' )->safe_set_value( substr( $signature->data(), 0, 8 ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if ( $config->{'extra_properties'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-bits' )->safe_set_value( $key_size ) ) if $key_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-keytype' )->safe_set_value( $key_type ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-algorithm' )->safe_set_value( $hash_algorithm ) ) if $hash_algorithm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-selector' )->safe_set_value( $selector ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $self->add_auth_header($header); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 167 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( $type )->safe_set_value( $signature_result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 167 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( $result_comment . $key_data ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 167 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.d' )->safe_set_value( $signature->domain() ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 167 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.i' )->safe_set_value( $signature->identity() ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 167 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.b' )->safe_set_value( substr( $signature->data(), 0, 8 ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 167 | ▶ | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.a' )->safe_set_value( $key_type . '-' . $hash_algorithm ) ) if ($key_type && $hash_algorithm); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$key_type and $hash_algorithm
MC/DC0%0/2
$key_type and $hash_algorithm
$key_type
$hash_algorithm
Truth table33%1/3
A and B
A= $key_typeB= $hash_algorithm
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 167 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'header.s' )->safe_set_value( $selector ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 167 | ▶ | if ( $config->{'extra_properties'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 12 | ▶ | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-bits' )->safe_set_value( $key_size ) ) if $key_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 167 | ▶ | if ( $config->{'log_dns_record'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | my $dkim_dns_name = $selector . '._domainkey.' . $signature->domain(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | my $resolver = $self->get_object('resolver'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | my $reply = $resolver->query( $dkim_dns_name, 'TXT' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | ▶ | if ( $reply ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | my @txt_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | for my $rr ( $reply->answer ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | ▶ | next unless $rr->type eq 'TXT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 2 | push @txt_parts, join( '', $rr->txtdata ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 2 | ▶ | if ( @txt_parts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 2 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'x-dns-record=' . $self->escape_non_printable_ascii( join( ' ', @txt_parts ) ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 2 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 167 | $self->add_auth_header($header); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 167 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # the alleged author of the email may specify how to handle email | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 135 | ▶ | if ( $config->{'check_adsp'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$config->{"check_adsp"} and $self->is_local_ip_address == 0 and $self->is_trusted_ip_address == 0 and $self->is_authenticated == 0
$config->{"check_adsp"} and $self->is_local_ip_address == 0 and $self->is_trusted_ip_address == 0
$config->{"check_adsp"} and $self->is_local_ip_address == 0
MC/DC75%3/4
$config->{"check_adsp"} and $self->is_local_ip_address == 0 and $self->is_trusted_ip_address == 0 and $self->is_authenticated == 0
$config->{"check_adsp"}
$self->is_local_ip_address == 0
$self->is_trusted_ip_address == 0
$self->is_authenticated == 0
Truth table80%4/5
A and B and C and D
A= $config->{"check_adsp"}B= $self->is_local_ip_address == 0C= $self->is_trusted_ip_address == 0D= $self->is_authenticated == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | && ( $self->is_local_ip_address() == 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | && ( $self->is_trusted_ip_address() == 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | && ( $self->is_authenticated() == 0 ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | POLICY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 36 | foreach my $policy ( $dkim->policies() ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 108 | my $apply = $policy->apply($dkim); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 108 | my $string = $policy->as_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 108 | ▶ | my $location = $policy->location() || q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$policy->location || ''
MC/DC100%1/1
$policy->location || ''
$policy->location
Truth table100%2/2
A
A= $policy->location
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 108 | my $name = $policy->name(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 108 | my $default = $policy->is_implied_default_policy(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 108 | my $otype = ref $policy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 108 | ▶ | my $type = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | $otype eq 'Mail::DKIM::AuthorDomainPolicy' ? 'dkim-adsp' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | : $otype eq 'Mail::DKIM::DkimPolicy' ? 'x-dkim-ssp' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | : $otype eq 'Mail::DKIM::DkPolicy' ? 'x-dkim-dkssp' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | : 'x-dkim-policy'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 108 | $self->dbgout( 'DKIMPolicy', $apply, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 108 | $self->dbgout( 'DKIMPolicyString', $string, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 108 | $self->dbgout( 'DKIMPolicyLocation', $location, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 108 | $self->dbgout( 'DKIMPolicyName', $name, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 108 | ▶ | $self->dbgout( 'DKIMPolicyDefault', $default ? 'yes' : 'no', LOG_DEBUG ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 108 | ▶ | next POLICY if ( ( $type eq 'x-dkim-dkssp' ) && ( ! $self->show_domainkeys() ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "x-dkim-dkssp" and not $self->show_domainkeys
MC/DC0%0/2
$type eq "x-dkim-dkssp" and not $self->show_domainkeys
$type eq "x-dkim-dkssp"
not $self->show_domainkeys
Truth table66%2/3
A and not(B)
A= $type eq "x-dkim-dkssp"B= not $self->show_domainkeys
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 108 | ▶ | my $result = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $apply eq 'accept' ? 'pass' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | : $apply eq 'reject' ? 'discard' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | : $apply eq 'neutral' ? 'unknown' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | : 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 108 | ▶ | if ( ! ( $config->{'adsp_hide_none'} && $result eq 'none' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$config->{"adsp_hide_none"} and $result eq "none"
MC/DC0%0/2
$config->{"adsp_hide_none"} and $result eq "none"
$config->{"adsp_hide_none"}
$result eq "none"
Truth table66%2/3
A and B
A= $config->{"adsp_hide_none"}B= $result eq "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 108 | ▶ | if ( ( ! $default ) or $config->{'show_default_adsp'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $default or $config->{"show_default_adsp"}
MC/DC50%1/2
not $default or $config->{"show_default_adsp"}
not $default
$config->{"show_default_adsp"}
Truth table66%2/3
not(A) or B
A= not $defaultB= $config->{"show_default_adsp"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 36 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( $type )->safe_set_value( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 36 | ▶ | my $comment = ( $default ? 'default ' : q{} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | . "$name policy" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | . ( $location ? " from $location" : q{} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # . ( $string ? ", $string" : q{} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 36 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( $comment ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 36 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 108 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 135 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # Also in DMARC module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $self->log_error( 'DKIM EOM Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $self->metric_count( 'dkim_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 127 | ▶ | sub close_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close_callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 127 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 127 | delete $self->{'failmode'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 127 | delete $self->{'headers'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 127 | delete $self->{'body'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 127 | delete $self->{'carry'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 127 | delete $self->{'has_dkim'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 127 | delete $self->{'valid_domains'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 127 | delete $self->{'early_lookups'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 127 | $self->destroy_object('dkim'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub _check_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_error: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my ( $self, $error ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if ( $error =~ /^DNS error: query timed out/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$error =~ /^DNS error: query timed out/u or $error =~ /^DNS query timeout/u
MC/DC0%0/2
$error =~ /^DNS error: query timed out/u or $error =~ /^DNS query timeout/u
$error =~ /^DNS error: query timed out/u
$error =~ /^DNS query timeout/u
Truth table0%0/3
A or B
A= $error =~ /^DNS error: query timed out/uB= $error =~ /^DNS query timeout/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | or $error =~ /^DNS query timeout/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $self->log_error( 'Temp DKIM Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'dns timeout' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | elsif ( $error =~ /^DNS error: SERVFAIL/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $self->log_error( 'Temp DKIM Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'dns servfail' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | ▶ | elsif ( $error =~ /^no domain to fetch policy for$/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$error =~ /^no domain to fetch policy for$/u or $error =~ /^policy syntax error$/u or $error =~ /^empty domain label/u or $error =~ /^invalid name /u
$error =~ /^no domain to fetch policy for$/u or $error =~ /^policy syntax error$/u or $error =~ /^empty domain label/u
$error =~ /^no domain to fetch policy for$/u or $error =~ /^policy syntax error$/u
MC/DC0%0/4
$error =~ /^no domain to fetch policy for$/u or $error =~ /^policy syntax error$/u or $error =~ /^empty domain label/u or $error =~ /^invalid name /u
$error =~ /^no domain to fetch policy for$/u
$error =~ /^policy syntax error$/u
$error =~ /^empty domain label/u
$error =~ /^invalid name /u
Truth table0%0/5
A or B or C or D
A= $error =~ /^no domain to fetch policy for$/uB= $error =~ /^policy syntax error$/uC= $error =~ /^empty domain label/uD= $error =~ /^invalid name /u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | or $error =~ /^policy syntax error$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | or $error =~ /^empty domain label/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | or $error =~ /^invalid name / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $self->log_error( 'Perm DKIM Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( 'permerror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'syntax or domain error' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $self->exit_on_close( 'Unexpected DKIM Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'dkim' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # Fill these in as they occur, but for unknowns err on the side of caution | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # and tempfail/exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $self->tempfail_on_error(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 44 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||