| 1 | package Mail::Milter::Authentication::Handler::ARC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use Mail::Milter::Authentication::Pragmas; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Handler class for ARC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | our $VERSION = '4.20261116'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use base 'Mail::Milter::Authentication::Handler'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Mail::DKIM 1.20200824; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use Mail::DKIM::ARC::Signer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use Mail::DKIM::ARC::Verifier; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Mail::DKIM::DNS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | use Mail::DKIM::TextWrap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 8 | ▶ | use Mail::AuthenticationResults::Parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub default_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | 'hide_none' => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 'arcseal_domain' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 'arcseal_selector' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 'arcseal_algorithm' => 'rsa-sha256', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 'arcseal_key' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 'arcseal_keyfile' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 'arcseal_headers' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 'arcseal_strip_aar_comments' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'trusted_domains' => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'rbl_whitelist' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 'no_strict' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub grafana_rows { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grafana_rows: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | push @rows, $self->get_json( 'ARC_metrics' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | return \@rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 34 | ▶ | sub register_metrics { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_metrics: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 34 | 'arc_total' => 'The number of emails processed for ARC', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 'arc_signatures' => 'The number of signatures processed for ARC', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 'arcseal_total' => 'The number of ARC seals added', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 67 | ▶ | sub is_domain_trusted { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_domain_trusted: called CC=7 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 67 | my ( $self, $domain ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 67 | ▶ | return 0 if ! defined $domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 67 | $domain = lc $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 67 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 67 | my $trusted_domains = $config->{ 'trusted_domains' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 67 | ▶ | if ( $trusted_domains ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 67 | foreach my $trusted_domain ( @$trusted_domains ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 67 | ▶ | if ( $domain eq lc $trusted_domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | #$self->dbgout( 'ARCResult', 'ARC domain trusted by static list', LOG_INFO ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 63 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | my $rbl_whitelist = $config->{ 'rbl_whitelist' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | ▶ | if ( $rbl_whitelist ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ( $self->rbl_check_domain( $domain, $rbl_whitelist ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #$self->dbgout( 'ARCResult', 'ARC domain trusted by dns list', LOG_INFO ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 11 | ▶ | sub get_trusted_spf_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_trusted_spf_results: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 11 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 11 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 11 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 10 | my @trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 10 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 10 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'spf' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 10 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 10 | my $smtp_mailfrom = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'smtp.mailfrom' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 10 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 10 | ▶ | next RESULT if ! $smtp_mailfrom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # smtp.mailfrom may be a bare domain (RFC 8601 Appendix B.3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 10 | ▶ | my $result_domain = $smtp_mailfrom =~ /\@/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ? $self->get_domain_from( $smtp_mailfrom ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | : lc $smtp_mailfrom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 10 | ▶ | next RESULT if ! $result_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 6 | push @trusted_results, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 'domain' => $result_domain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 'scope' => 'mfrom', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 'result' => $result->value(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 10 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 10 | return \@trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 6 | ▶ | sub get_trusted_dkim_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_trusted_dkim_results: called CC=12 SCAR=25.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 6 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 6 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 6 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 5 | my @trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 5 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 5 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'dkim' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 5 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 5 | my $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.d' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 5 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | ▶ | if ( ! $entry_domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # No domain, check for an identifier instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.i' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | ▶ | if ( $entry_domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | $entry_domain =~ s/^.*\@//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 5 | ▶ | next RESULT if ! $entry_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | $entry_domain = lc $entry_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 4 | my $entry_selector = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'x-selector' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 4 | ▶ | if ( ! defined $entry_selector ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Google are using header.s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | $entry_selector = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.s' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 4 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # If we don't have a selector then we fake it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 4 | ▶ | $entry_selector = 'x-arc-chain' if ! defined $entry_selector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | ▶ | $entry_selector = 'x-arc-chain' if $entry_selector eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ## TODO If we can't find this in the ar header then we could | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ## try looking for the Signature and pull it from there. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ## But let's not do that right now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 4 | ▶ | next RESULT if ! $entry_selector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | #my $result_domain = $self->get_domain_from( $smtp_mailfrom ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | push @trusted_results, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 'domain' => $entry_domain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 'selector' => $entry_selector, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 'result' => $result->value(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 'human_result' => 'Trusted ARC entry', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 5 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 5 | return \@trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | ▶ | sub get_trusted_dmarc_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_trusted_dmarc_results: called CC=6 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | my @trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'dmarc' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.from' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | next RESULT if ! $entry_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $entry_domain = lc $entry_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | push @trusted_results, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 'domain' => $entry_domain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 'result' => $result->value(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 'human_result' => 'Trusted ARC entry', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | return \@trusted_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | ▶ | sub inherit_trusted_spf_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherit_trusted_spf_results: called CC=8 SCAR=31.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | ▶ | return if ( ! $self->is_handler_loaded( 'SPF' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Find all ARC SPF results which passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'spf', 'value' => 'pass' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # Does the entry have an x-arc-domain entry? if do then leave it alone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | next RESULT if ( scalar @{ $result->search({ 'isa' => 'subentry', 'key' => 'x-arc-domain' })->children() }> 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # Does the entry have a smtp.mailfrom entry we can match on? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $smtp_mailfrom = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'smtp.mailfrom' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | next RESULT if ! $smtp_mailfrom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $smtp_mailfrom = lc $smtp_mailfrom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # And add the new one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-instance' )->safe_set_value( $instance ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-domain' )->safe_set_value( $self->{ 'arc_domain'}->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $result->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'Trusted from aar.' . $instance . '.' . $self->{ 'arc_domain' }->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $result->orphan(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $result->set_key( 'x-arc-spf' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $self->add_auth_header( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 2 | ▶ | sub inherit_trusted_dkim_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherit_trusted_dkim_results: called CC=10 SCAR=26.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | ▶ | return if ( ! $self->is_handler_loaded( 'DKIM' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 2 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # Find all ARC DKIM results which passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'dkim', 'value' => 'pass' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # Does the entry have an x-arc-domain entry? if do then leave it alone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | next RESULT if ( scalar @{ $result->search({ 'isa' => 'subentry', 'key' => 'x-arc-domain' })->children() }> 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # Does the entry have a domain identifier we can match on? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | my $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.d' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | if ( ! $entry_domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # No domain, check for an identifier instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.i' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if ( $entry_domain ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $entry_domain =~ s/^.*\@//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | ▶ | next RESULT if ! $entry_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | $entry_domain = lc $entry_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # And add the new one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-instance' )->safe_set_value( $instance ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-domain' )->safe_set_value( $self->{ 'arc_domain'}->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | $result->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'Trusted from aar.' . $instance . '.' . $self->{ 'arc_domain' }->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | $result->orphan(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | $result->set_key( 'x-arc-dkim' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | $self->add_auth_header( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | ▶ | sub inherit_trusted_dmarc_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherit_trusted_dmarc_results: called CC=8 SCAR=31.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ▶ | return if ( ! $self->is_handler_loaded( 'DMARC' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | foreach my $instance ( sort { $a <=> $b } keys %$aar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # Find all ARC DMARC results which passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => 'dmarc', 'value' => 'pass' })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # Does the entry have an x-arc-domain entry? if do then leave it alone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | next RESULT if ( scalar @{ $result->search({ 'isa' => 'subentry', 'key' => 'x-arc-domain' })->children() }> 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # Does the entry have a domain identifier we can match on? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my $entry_domain = eval{ $result->search({ 'isa' => 'subentry', 'key' => 'header.from' })->children()->[0]->value() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | next RESULT if ! $entry_domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $entry_domain = lc $entry_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # And add the new one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-instance' )->safe_set_value( $instance ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-domain' )->safe_set_value( $self->{ 'arc_domain'}->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $result->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'Trusted from aar.' . $instance . '.' . $self->{ 'arc_domain' }->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $result->orphan(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $result->set_key( 'x-arc-dmarc' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->add_auth_header( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | ▶ | sub inherit_trusted_ip_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherit_trusted_ip_results: called CC=6 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # Add result from first trusted ingress hop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my ( $instance ) = sort { $a <=> $b } keys %$aar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | foreach my $thing ( sort qw { iprev x-ptr } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 2 | my $results = $aar->{$instance}->search({ 'isa' => 'entry', 'key' => $thing })->children(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | RESULT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | foreach my $result ( @$results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | next RESULT if ( scalar @{ $result->search({ 'isa' => 'subentry', 'key' => 'x-arc-domain' })->children() }> 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-instance' )->safe_set_value( $instance ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $result->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'x-arc-domain' )->safe_set_value( $self->{ 'arc_domain'}->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $result->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'Trusted from aar.' . $instance . '.' . $self->{ 'arc_domain' }->{ $instance } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $result->orphan(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $result->set_key( 'x-arc-'.$thing ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->add_auth_header( $result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 2 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 35 | ▶ | sub get_trusted_arc_authentication_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_trusted_arc_authentication_results: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 35 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # First, we need an arc pass or we trust nothing! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 35 | ▶ | return if $self->{ 'arc_result' } ne 'pass'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 28 | my $trusted_aar = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | INSTANCE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 28 | foreach my $instance ( reverse sort { $a <=> $b } keys %{$self->{ 'arc_auth_results' } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 46 | ▶ | my $signature_domain = $self->{'arc_domain'}->{ $instance } // q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"arc_domain"}{$instance} // ""
MC/DC0%0/1
$self->{"arc_domain"}{$instance} // ""
$self->{"arc_domain"}{$instance}
Truth table50%1/2
A
A= $self->{"arc_domain"}{$instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 46 | ▶ | if ( ! $self->{'arc_aar_duplicate'}->{ $instance } && $self->is_domain_trusted( $signature_domain ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $self->{"arc_aar_duplicate"}{$instance} and $self->is_domain_trusted($signature_domain)
MC/DC100%2/2
not $self->{"arc_aar_duplicate"}{$instance} and $self->is_domain_trusted($signature_domain)
not $self->{"arc_aar_duplicate"}{$instance}
$self->is_domain_trusted($signature_domain)
Truth table100%3/3
not(A) and B
A= not $self->{"arc_aar_duplicate"}{$instance}B= $self->is_domain_trusted($signature_domain)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # Clone this, so we can safely modify entries later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 43 | $trusted_aar->{ $instance } = clone $self->{ 'arc_auth_results' }->{ $instance }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # We don't trust this host, we can't trust anything before it! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 3 | last INSTANCE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 28 | ▶ | if ( scalar keys %$trusted_aar == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 26 | return $trusted_aar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # Do we trust the entire chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 5 | ▶ | sub is_chain_trusted { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_chain_trusted: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 5 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 5 | ▶ | return 0 if $self->{ 'arc_result' } ne 'pass'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 5 | ▶ | return 0 if keys %{ $self->{ 'arc_aar_duplicate' } // {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{"arc_aar_duplicate"} // {}
MC/DC0%0/1
$self->{"arc_aar_duplicate"} // {}
$self->{"arc_aar_duplicate"}
Truth table50%1/2
A
A= $self->{"arc_aar_duplicate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 4 | foreach my $instance ( reverse sort { $a <=> $b } keys %{$self->{ 'arc_auth_results' } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 22 | ▶ | my $signature_domain = $self->{'arc_domain'}->{ $instance } // q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"arc_domain"}{$instance} // ""
MC/DC0%0/1
$self->{"arc_domain"}{$instance} // ""
$self->{"arc_domain"}{$instance}
Truth table50%1/2
A
A= $self->{"arc_domain"}{$instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 22 | ▶ | return 0 if ! $self->is_domain_trusted( $signature_domain ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # Get the trusted ingress IP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | sub get_arc_trusted_ingress_ip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_arc_trusted_ingress_ip: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | my $aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | return if ! $aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my ( $first_instance ) = sort { $a <=> $b } keys %$aar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | return if ! $first_instance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my $ip; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $ip = eval{ $aar->{$first_instance}->search({ 'isa' => 'entry', 'key' => 'iprev' })->children()->[0]->search({ 'isa' => 'subentry', 'key' => 'smtp.remote-ip'})->children()->[0]->value(); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | return $ip if $ip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $ip = eval{ $aar->{$first_instance}->search({ 'isa' => 'entry', 'key' => 'iprev' })->children()->[0]->search({ 'isa' => 'subentry', 'key' => 'policy.iprev'})->children()->[0]->value(); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $self->log_error( 'ARC Inherit Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return $ip; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # Find the earliest instance in the trusted chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | sub search_trusted_aar { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search_trusted_aar: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my ( $self, $search ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $trusted_aar = $self->get_trusted_arc_authentication_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | return if ! $trusted_aar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | foreach my $instance ( sort { $a <=> $b } keys %{$trusted_aar} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $found = $trusted_aar->{ $instance }->search( $search ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( scalar @{ $found->children() } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | return $found; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 41 | ▶ | sub envfrom_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
envfrom_callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 41 | my ( $self, $env_from ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 41 | $self->{'failmode'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 41 | $self->{'headers'} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 41 | $self->{'body'} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 41 | $self->{'has_arc'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 41 | $self->{'valid_domains'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 41 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 41 | $self->{'arc_auth_results'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 41 | $self->{'arc_aar_duplicate'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 41 | $self->{'arc_domain'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 41 | $self->{'arc_result'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 41 | $self->{'ar_header_count'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 41 | $self->{'ar_chunk_index'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 41 | $self->destroy_object('arc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 115 | ▶ | sub header_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_callback: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 115 | my ( $self, $header, $value, $original ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 115 | my $EOL = "\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 115 | my $arc_chunk = $original . $EOL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 115 | $arc_chunk =~ s/\015?\012/$EOL/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 115 | push @{$self->{'headers'}} , $arc_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # Remember where each Authentication-Results header landed in the cache, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # keyed by its occurrence number. Sanitize records its removals by the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # occurrence numbering, so the sealer can map them back to cache entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # and exclude them. See addheader_callback. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 115 | ▶ | if ( lc($header) eq 'authentication-results' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 9 | $self->{'ar_header_count'}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | $self->{'ar_chunk_index'}->{ $self->{'ar_header_count'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 9 | = scalar( @{$self->{'headers'}} ) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 115 | ▶ | if ( lc($header) eq 'arc-authentication-results' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 25 | $self->{'has_arc'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 25 | my ( $instance, $aar ) = split( ';', $value, 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # The instance tag must be the entire first tag, matching how Mail::DKIM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # identifies the AAR for an instance. A looser match lets a header which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # Mail::DKIM does not consider to be part of the chain be cached as one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # that is, and have its results trusted on behalf of the sealer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 25 | ▶ | if ( $instance =~ /^\s*i=(\d+)\s*$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 23 | $instance = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 23 | ▶ | if ( exists $self->{'arc_auth_results'}->{ $instance } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # Never replace an AAR we have already seen, and never trust an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # instance which has more than one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | $self->{'arc_aar_duplicate'}->{ $instance } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 21 | my $parsed = eval{ Mail::AuthenticationResults->parser()->parse( $aar ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 21 | $self->handle_exception( $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 21 | $self->{'arc_auth_results'}->{ $instance } = $parsed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 115 | ▶ | if ( lc($header) eq 'arc-seal' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 1 | $self->{'has_arc'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 115 | ▶ | if ( lc($header) eq 'arc-message-signature' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | $self->{'has_arc'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 22 | ▶ | sub eoh_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eoh_callback: called CC=13 SCAR=31.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 22 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 22 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 22 | ▶ | if ($config->{arcseal_domain} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$config->{"arcseal_domain"} and $config->{"arcseal_selector"} and $config->{"arcseal_key"} || $config->{"arcseal_keyfile"}
$config->{"arcseal_domain"} and $config->{"arcseal_selector"}
$config->{"arcseal_key"} or $config->{"arcseal_keyfile"}
MC/DC25%1/4
$config->{"arcseal_domain"} and $config->{"arcseal_selector"} and $config->{"arcseal_key"} || $config->{"arcseal_keyfile"}
$config->{"arcseal_domain"}
$config->{"arcseal_selector"}
$config->{"arcseal_key"}
$config->{"arcseal_keyfile"}
Truth table40%2/5
A and B and C or D
A= $config->{"arcseal_domain"}B= $config->{"arcseal_selector"}C= $config->{"arcseal_key"}D= $config->{"arcseal_keyfile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | $config->{arcseal_selector} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | ($config->{arcseal_key} || $config->{arcseal_keyfile})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 11 | $self->{has_arcseal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 22 | ▶ | unless ($self->{'has_arc'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 20 | $self->metric_count( 'arc_total', { 'result' => 'none' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 20 | $self->dbgout( 'ARCResult', 'No ARC headers', LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 20 | ▶ | unless ($config->{'hide_none'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 20 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( 'none' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 20 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'no signatures found' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 20 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 20 | $self->{arc_result} = 'none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 20 | ▶ | delete $self->{headers} unless $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 2 | my $arc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | my $UseStrict = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | ▶ | if ( $config->{ 'no_strict' } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $UseStrict = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | $arc = Mail::DKIM::ARC::Verifier->new( 'Strict' => $UseStrict ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | my $resolver = $self->get_object('resolver'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 2 | Mail::DKIM::DNS::resolver($resolver); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 2 | $self->set_object('arc', $arc, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 2 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $self->log_error( 'ARC Setup Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $self->metric_count( 'arc_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->{arc_result} = 'fail'; # XXX - handle tempfail better | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | delete $self->{headers} unless $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | $arc->PRINT( join q{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | @{ $self->{'headers'} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | "\015\012", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 2 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $self->log_error( 'ARC Headers Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->metric_count( 'arc_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $self->{arc_result} = 'fail'; # XXX - handle tempfail better | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | delete $self->{headers} unless $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 22 | ▶ | sub body_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
body_callback: called CC=8 SCAR=25.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 22 | my ( $self, $body_chunk ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 22 | my $EOL = "\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 22 | my $arc_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 22 | ▶ | if ( $self->{'carry'} ne q{} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $arc_chunk = $self->{'carry'} . $body_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $self->{'carry'} = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 22 | $arc_chunk = $body_chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 22 | ▶ | if ( substr( $arc_chunk, -1 ) eq "\015" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | $self->{'carry'} = "\015"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $arc_chunk = substr( $arc_chunk, 0, -1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 22 | $arc_chunk =~ s/\015?\012/$EOL/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 22 | ▶ | push @{$self->{body}}, $arc_chunk if $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 22 | ▶ | if ($self->{has_arc} and not $self->{failmode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"has_arc"} and not $self->{"failmode"}
MC/DC50%1/2
$self->{"has_arc"} and not $self->{"failmode"}
$self->{"has_arc"}
not $self->{"failmode"}
Truth table66%2/3
A and not(B)
A= $self->{"has_arc"}B= not $self->{"failmode"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 2 | my $arc = $self->get_object('arc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 2 | $arc->PRINT( $arc_chunk ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 2 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $self->log_error( 'ARC Body Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $self->metric_count( 'arc_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $self->{arc_result} = 'fail'; # XXX - handle tempfail better | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | delete $self->{headers} unless $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 34 | ▶ | sub eom_requires { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eom_requires: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 34 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 34 | my @requires; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 34 | ▶ | if ( $self->is_handler_loaded( 'DKIM' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 2 | push @requires, 'DKIM'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 34 | return \@requires; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 22 | ▶ | sub eom_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eom_callback: called CC=14 SCAR=28.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | push @{$self->{body}}, $self->{carry} if ($self->{carry} and $self->{has_arcseal}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"carry"} and $self->{"has_arcseal"}
MC/DC0%0/2
$self->{"carry"} and $self->{"has_arcseal"}
$self->{"carry"}
$self->{"has_arcseal"}
Truth table33%1/3
A and B
A= $self->{"carry"}B= $self->{"has_arcseal"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | # the rest of eom is only used for arc, not arcseal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 22 | ▶ | return unless $self->{'has_arc'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 2 | ▶ | return if $self->{'failmode'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 2 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 2 | my $arc = $self->get_object('arc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 2 | $arc->PRINT( $self->{'carry'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 2 | $arc->CLOSE(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 2 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 2 | my $arc_result = $arc->result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 2 | my $arc_result_detail = $arc->result_detail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 2 | $self->metric_count( 'arc_total', { 'result' => $arc_result } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 2 | $self->dbgout( 'ARCResult', $arc_result_detail, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 2 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( $arc_result ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 2 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 2 | foreach my $signature ( @{ $arc->{signatures} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 2 | ▶ | my $type = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | ref($signature) eq 'Mail::DKIM::ARC::Seal' ? 'as' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | : ref($signature) eq 'Mail::DKIM::ARC::MessageSignature' ? 'ams' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | : ref($signature); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 2 | ▶ | push @items, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$signature->instance || ''
$signature->domain || '(none)'
$signature->result_detail || '?'
MC/DC0%0/1
$signature->instance || ''
$signature->instance
MC/DC0%0/1
$signature->domain || '(none)'
$signature->domain
MC/DC0%0/1
$signature->result_detail || '?'
$signature->result_detail
Truth table50%1/2
A
A= $signature->instance
Truth table50%1/2
A
A= $signature->domain
Truth table50%1/2
A
A= $signature->result_detail
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | "$type." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | . ( $signature->instance() || '' ) . '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | . ( $signature->domain() || '(none)' ) . '=' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | . ( $signature->result_detail() || '?' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 2 | $self->{ 'arc_domain' }->{ $signature->instance() } = $signature->domain(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | ▶ | if ( @items ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 1 | my $header_comment = Mail::AuthenticationResults::Header::Comment->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | my $header_comment_text = join( ', ', @items ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # Try set_value first (required for potential nested comment), if this fails then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | # set using safe_set_value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 1 | eval { $header_comment->set_value( $header_comment_text ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | $header_comment->safe_set_value( $header_comment_text ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 1 | $header->add_child( $header_comment ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 2 | my $ip_address = $self->ip_address(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 2 | $header->add_child( Mail::AuthenticationResults::Header::SubEntry->new()->set_key( 'smtp.remote-ip' )->safe_set_value( $ip_address ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 2 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 2 | $self->{arc_result} = $arc_result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 2 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | $self->log_error( 'ARC EOM Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | $self->_check_error( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->metric_count( 'arc_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | $self->{'failmode'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | $self->{arc_result} = 'fail'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 2 | $self->inherit_trusted_spf_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 2 | $self->inherit_trusted_dkim_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 2 | $self->inherit_trusted_ip_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 2 | $self->inherit_trusted_dmarc_results(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 33 | ▶ | sub close_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close_callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 33 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 33 | delete $self->{'failmode'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 33 | delete $self->{'headers'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 33 | delete $self->{'body'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 33 | delete $self->{'carry'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 33 | delete $self->{'has_arc'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 33 | delete $self->{'has_arcseal'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 33 | delete $self->{'valid_domains'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 33 | delete $self->{'arc_domain'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 33 | delete $self->{'arc_result'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 33 | delete $self->{'arc_auth_results'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 33 | delete $self->{'arc_aar_duplicate'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 33 | delete $self->{'ar_header_count'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 33 | delete $self->{'ar_chunk_index'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 33 | $self->destroy_object('arc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub _check_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_error: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my ( $self, $error ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | or $error =~ /^DNS query timeout/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $self->log_error( 'Temp ARC Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'dns timeout' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | elsif ( $error =~ /^DNS error: SERVFAIL/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $self->log_error( 'Temp ARC Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'dns servfail' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | or $error =~ /^policy syntax error$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | or $error =~ /^empty domain label/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | or $error =~ /^invalid name / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | $self->log_error( 'Perm ARC Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( 'permerror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | $header->add_child( Mail::AuthenticationResults::Header::Comment->new()->safe_set_value( 'syntax or domain error' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $self->exit_on_close( 'Unexpected ARC Error - ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | my $header = Mail::AuthenticationResults::Header::Entry->new()->set_key( 'arc' )->safe_set_value( 'temperror' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $self->add_auth_header( $header ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # Fill these in as they occur, but for unknowns err on the side of caution | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | # and tempfail/exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $self->tempfail_on_error(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | # Map Sanitize's Authentication-Results removals onto positions in our own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | # header cache, returning a hashref of { chunk_index => 1 }. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # Sanitize numbers the A-R headers it removes by occurrence (1-based, in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | # received order) and header_callback records the same numbering against cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | # positions, so the two line up directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | # Returns an empty set when Sanitize is not loaded, or has removed nothing, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # behaviour is unchanged for anyone not running that handler. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 22 | ▶ | sub _sanitize_removed_ar_chunks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sanitize_removed_ar_chunks: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 22 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 22 | my $removals = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 22 | ▶ | return $removals if ! $self->is_handler_loaded('Sanitize'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 10 | my $occurrences = $self->get_handler('Sanitize') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | ->get_removed_auth_header_indexes('Authentication-Results'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 10 | foreach my $occurrence ( @{ $occurrences } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 10 | my $chunk_index = $self->{'ar_chunk_index'}->{ $occurrence }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 10 | ▶ | next if ! defined $chunk_index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 10 | $removals->{ $chunk_index } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 10 | return $removals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 65 | ▶ | sub _fmtheader { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fmtheader: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 65 | my $header = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 65 | my $value = $header->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 65 | $value =~ s/\015?\012/\015\012/gs; # make sure line endings are right | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 65 | return "$header->{field}: $value\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # Is Authentication-Results in the configured arcseal_headers list? If so the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # AMS signs the A-R headers themselves, and a stripped copy would no longer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # match what is delivered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 8 | ▶ | sub _ar_is_ams_signed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ar_is_ams_signed: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 8 | my ( $config ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 8 | ▶ | my $extra = $config->{'arcseal_headers'} // q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$config->{"arcseal_headers"} // ""
MC/DC100%1/1
$config->{"arcseal_headers"} // ""
$config->{"arcseal_headers"}
Truth table100%2/2
A
A= $config->{"arcseal_headers"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 8 | return scalar grep { lc $_ eq 'authentication-results' } split /\s*:\s*/, $extra; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # Mail::DKIM::ARC::Signer copies our Authentication-Results header text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # verbatim into the ARC-Authentication-Results header it seals. With | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # arcseal_strip_aar_comments set, hand it a copy of each Authentication-Results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # header with the RFC 8601 comments removed; the delivered Authentication-Results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # header is not touched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # Why: Microsoft 365 returns arc=fail (35) for an otherwise valid chain when an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # AAR result ends with a comment after a property value, for example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # "iprev=pass smtp.remote-ip=192.0.2.1 (host.example.net)" or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | # "x-return-mx=pass ... policy.is_org=yes (MX Records found: ...)". Comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | # are permitted there, so this is a receiver bug, but the iprev form appears on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | # almost every message this milter seals. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | # Anything that does not parse is passed through unchanged, as are all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | # non Authentication-Results headers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 137 | ▶ | sub _aar_seal_copy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_aar_seal_copy: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 137 | my ( $self, $config, $text ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 137 | ▶ | return $text if ! $config->{'arcseal_strip_aar_comments'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 35 | ▶ | return $text if $text !~ /^Authentication-Results\s*:/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 8 | ▶ | return $text if _ar_is_ams_signed( $config ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 6 | my $stripped = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 6 | my $parsed = Mail::AuthenticationResults::Parser->new()->parse( $text ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 4 | foreach my $comment ( @{ $parsed->search({ 'isa' => 'comment' })->children() } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 8 | $comment->parent()->remove_child( $comment ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 4 | my $value = $parsed->as_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 4 | $value =~ s/\015?\012/\015\012/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 4 | "Authentication-Results: $value\015\012"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 6 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 2 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 1 | $self->log_error( 'ARCSeal AAR comment strip Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | return $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 4 | return $stripped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 44 | ▶ | sub addheader_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addheader_callback: called CC=16 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 44 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 44 | my $handler = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 44 | ▶ | return unless $self->{has_arcseal}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 22 | my $config = $self->handler_config(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 22 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 22 | my %KeyOpts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 22 | ▶ | if ($config->{arcseal_keyfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $KeyOpts{KeyFile} = $config->{arcseal_keyfile}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | $KeyOpts{Key} = Mail::DKIM::PrivateKey->load( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 22 | Data => $config->{arcseal_key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | my $arcseal = Mail::DKIM::ARC::Signer->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | Algorithm => $config->{arcseal_algorithm}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | Domain => $config->{arcseal_domain}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | SrvId => $self->get_my_authserv_id(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | Selector => $config->{arcseal_selector}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | Headers => $config->{arcseal_headers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # chain value is arc_result from previous seal validation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | Chain => $self->{arc_result}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 22 | Timestamp => time(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | %KeyOpts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # pre-headers from handler (reversed as they will add in reverse) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 22 | ▶ | foreach my $header (reverse @{$handler->{pre_headers} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$handler->{'pre_headers'} || []
MC/DC0%0/1
$handler->{'pre_headers'} || []
$handler->{'pre_headers'}
Truth table50%1/2
A
A= $handler->{'pre_headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 55 | $arcseal->PRINT($self->_aar_seal_copy($config, _fmtheader($header))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | # Then all the original headers, EXCEPT any Authentication-Results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | # headers Sanitize has removed from the outgoing message. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | # Mail::DKIM::ARC::Signer builds the AAR by concatenating every | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | # Authentication-Results header in this stream whose authserv-id equals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | # SrvId. Inbound headers claiming our own authserv-id therefore end up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | # inside an AAR we sign, and sealing one we have just stripped attests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | # to results we deliberately rejected. On an untrusted connection those | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # values are attacker chosen, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | # get_trusted_arc_authentication_results() feeds AAR entries from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | # trusted chains back into DMARC enforcement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # Scope, deliberately narrow: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # - Only the A-R headers Sanitize tracks. That is sufficient for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # AAR because the Signer matches /^Authentication-Results:/, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | # extra_auth_results_types (X-Authentication-Results and friends) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | # can never reach it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | # - Sanitize removes a superset of what the Signer matches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | # is_hostname_mine() also matches subdomains, every hosts_to_remove | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | # entry and the local hostname's parent domain, and it removes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | # unparseable headers outright, whereas SrvId matching is exact. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | # Excluding the superset is safe -- those headers are not delivered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | # - The general change_header case remains unreflected in this cache. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # - Nothing changes when Sanitize is absent, disabled, or on a trusted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | # connection, where the inbound header is delivered AND sealed as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | # before. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | # If the forged header were the ONLY SrvId match, the Signer would find | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | # no results and skip sealing rather than seal attacker data. That | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # cannot happen here since our own A-R is in pre_headers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 22 | my $sealed_removals = $self->_sanitize_removed_ar_chunks(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 22 | my $chunk_index = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 22 | ▶ | foreach my $chunk (@{$self->{headers} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'headers'} || []
MC/DC0%0/1
$self->{'headers'} || []
$self->{'headers'}
Truth table50%1/2
A
A= $self->{'headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 80 | $chunk_index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 80 | ▶ | next if $sealed_removals->{$chunk_index}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 70 | $arcseal->PRINT($self->_aar_seal_copy($config, $chunk)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | # post-headers from handler (these are in order) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 22 | ▶ | foreach my $header (@{$handler->{add_headers} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$handler->{'add_headers'} || []
MC/DC100%1/1
$handler->{'add_headers'} || []
$handler->{'add_headers'}
Truth table100%2/2
A
A= $handler->{'add_headers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 10 | $arcseal->PRINT($self->_aar_seal_copy($config, _fmtheader($header))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 10 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | # finish header block with a blank line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 22 | $arcseal->PRINT("\015\012"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | # all the body chunks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 22 | foreach my $chunk (@{$self->{body}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 22 | $arcseal->PRINT($chunk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | # and we're done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 22 | $arcseal->CLOSE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 22 | $self->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 22 | my $arcseal_result = $arcseal->result(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 22 | my $arcseal_result_detail = $arcseal->result_detail(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 22 | $self->metric_count( 'arcseal_total', { 'result' => $arcseal_result } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 22 | $self->dbgout( 'ARCSealResult', $arcseal_result_detail, LOG_DEBUG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | # we need to extract the headers from ARCSeal and re-format them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | # back to the format that pre_headers expects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 22 | my $headers = $arcseal->as_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 22 | my @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 22 | my $current_header = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 22 | my $current_value = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 22 | foreach my $header_line ( (split ( /\015?\012/, $headers ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 137 | ▶ | if ( $header_line =~ /^\s/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | # Line begins with whitespace, add to previous header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 104 | $header_line =~ s/^\s+/ /; # for consistency | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 104 | $current_value .= "\n" . $header_line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | # This is a brand new header! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 33 | ▶ | if ( $current_header ne q{} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | # We have a cached header, add it now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 22 | push @list, { 'field' => $current_header, 'value' => $current_value }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 22 | $current_value = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 33 | ( $current_header, $current_value ) = split ( ':', $header_line, 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 33 | $current_value =~ s/^ +//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 22 | ▶ | if ( $current_header ne q{} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # We have a cached header, add it now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 11 | push @list, { 'field' => $current_header, 'value' => $current_value }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 11 | $current_value = q{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | # these will prepend in reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 22 | push @{$handler->{pre_headers}}, reverse @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 22 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | $self->handle_exception( $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | $self->log_error( 'ARCSeal Error ' . $error ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | $self->metric_count( 'arcseal_total', { 'result' => 'error' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||