| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Mail::SPF::Server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Server class for processing SPF requests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # (C) 2005-2012 Julian Mehnle <julian@mehnle.net> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # 2005 Shevek <cpan@anarres.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # $Id: Server.pm 61 2013-07-22 03:45:15Z julian $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | package Mail::SPF::Server; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | Mail::SPF::Server - Server class for processing SPF requests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | version 3.20261105 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | our $VERSION = '3.20261105'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | use base 'Mail::SPF::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | use Error ':try'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | ▶ | use Net::DNS::Packet; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 6 | ▶ | use Net::DNS::Resolver; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | use Mail::SPF::MacroString; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | use Mail::SPF::Record; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | ▶ | use Mail::SPF::Result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 6 | ▶ | use constant TRUE => (0 == 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | use constant FALSE => not TRUE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # Net::DNS::DomainName is available with Net::DNS 0.69 and later: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 6 | ▶ | use constant have_net_dns_domainname => eval { require Net::DNS::DomainName; TRUE }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 6 | ▶ | use constant record_classes_by_version => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 => 'Mail::SPF::v1::Record', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 => 'Mail::SPF::v2::Record' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | ▶ | use constant result_base_class => 'Mail::SPF::Result'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | use constant query_rr_type_all => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | use constant query_rr_type_txt => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | ▶ | use constant query_rr_type_spf => 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 6 | ▶ | use constant default_default_authority_explanation => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 6 | 'Rejected by SPF record.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 21 | ▶ | sub default_query_rr_types { shift->query_rr_type_txt }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_query_rr_types: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 6 | ▶ | use constant default_max_dns_interactive_terms => 10; # RFC 4408, 10.1/6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | use constant default_max_name_lookups_per_term => 10; # RFC 4408, 10.1/7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 20 | ▶ | sub default_max_name_lookups_per_mx_mech { shift->max_name_lookups_per_term }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_max_name_lookups_per_mx_mech: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 21 | ▶ | sub default_max_name_lookups_per_ptr_mech { shift->max_name_lookups_per_term }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_max_name_lookups_per_ptr_mech: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | ▶ | use constant default_max_void_dns_lookups => 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # Interface: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | use Mail::SPF; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | my $spf_server = Mail::SPF::Server->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # Optional custom default for authority explanation: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | default_authority_explanation => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'See http://www.%{d}/why/id=%{S};ip=%{I};r=%{R}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | my $result = $spf_server->process($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Implementation: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | B<Mail::SPF::Server> is a server class for processing SPF requests. Each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | server instance can be configured with specific processing parameters. Also, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | the default I<Net::DNS::Resolver> DNS resolver used for making DNS look-ups can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | be overridden with a custom resolver object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =head2 Constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | The following constructor is provided: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =item B<new(%options)>: returns I<Mail::SPF::Server> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Creates a new server object for processing SPF requests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | %options is a list of key/value pairs representing any of the following | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | options: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | =item B<default_authority_explanation> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | A I<string> denoting the default (not macro-expanded) authority explanation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | string to use if the authority domain does not specify an explanation string of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | its own. Defaults to: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'Rejected by SPF record.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | As can be seen from the default, a non-standard C<_scope> pseudo macro is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | supported that expands to the name of the identity's scope. (Note: Do I<not> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | use any non-standard macros in explanation strings published in DNS.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | =item B<hostname> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | A I<string> denoting the local system's fully qualified host name that should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | be used for expanding the C<r> macro in explanation strings. Defaults to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | system's configured host name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | =item B<dns_resolver> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | An optional DNS resolver object. If none is specified, a new I<Net::DNS::Resolver> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | object is used. The resolver object may be of a different class, but it must | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | provide an interface similar to I<Net::DNS::Resolver> -- at least the C<send> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | and C<errorstring> methods must be supported, and the C<send> method must | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | return either an object of class I<Net::DNS::Packet>, or, in the case of an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | error, B<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | =item B<query_rr_types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | For which RR types to query when looking up and selecting SPF records. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | following values are supported: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | =item B<< Mail::SPF::Server->query_rr_type_all >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | Both C<TXT> and C<SPF> type RRs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | =item B<< Mail::SPF::Server->query_rr_type_txt >> (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | C<TXT> type RRs only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | =item B<< Mail::SPF::Server->query_rr_type_spf >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | C<SPF> type RRs only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | For years B<Mail::SPF> has defaulted to looking up both C<SPF> and C<TXT> type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | RRs as recommended by RFC 4408. Experience has shown, however, that a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | significant portion of name servers suffer from serious brain damage with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | regard to the handling of queries for RR types that are unknown to them, such | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | as the C<SPF> RR type. Consequently B<Mail::SPF> now defaults to looking up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | only C<TXT> type RRs. This may be overridden by setting the B<query_rr_types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | See RFC 4408, 3.1.1, for a discussion of the topic, as well as the description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | of the L</select_record> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | =item B<max_dns_interactive_terms> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | An I<integer> denoting the maximum number of terms (mechanisms and modifiers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | per SPF check that perform DNS look-ups, as defined in RFC 4408, 10.1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | paragraph 6. If B<undef> is specified, there is no limit on the number of such | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | terms. Defaults to B<10>, which is the value defined in RFC 4408. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | A value above the default is I<strongly discouraged> for security reasons. A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | value below the default has implications with regard to the predictability of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | SPF results. Only deviate from the default if you know what you are doing! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | =item B<max_name_lookups_per_term> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | An I<integer> denoting the maximum number of DNS name look-ups per term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | (mechanism or modifier), as defined in RFC 4408, 10.1, paragraph 7. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | B<undef> is specified, there is no limit on the number of look-ups performed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | Defaults to B<10>, which is the value defined in RFC 4408. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | A value above the default is I<strongly discouraged> for security reasons. A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | value below the default has implications with regard to the predictability of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | SPF results. Only deviate from the default if you know what you are doing! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | =item B<max_name_lookups_per_mx_mech> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | =item B<max_name_lookups_per_ptr_mech> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | An I<integer> denoting the maximum number of DNS name look-ups per B<mx> or B<ptr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | mechanism, respectively. Defaults to the value of the C<max_name_lookups_per_term> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | option. See there for additional information and security notes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | =item B<max_void_dns_lookups> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | An I<integer> denoting the maximum number of "void" DNS look-ups per SPF check, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | i.e. the number of DNS look-ups that were caused by DNS-interactive terms and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | macros (as defined in RFC 4408, 10.1, paragraphs 6 and 7) and that are allowed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | to return an empty answer with RCODE 0 or RCODE 3 (C<NXDOMAIN>) before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | processing is aborted with a C<permerror> result. If B<undef> is specified, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | there is no stricter limit on the number of void DNS look-ups beyond the usual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | processing limits. Defaults to B<2>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | Specifically, the DNS look-ups that are subject to this limit are those caused | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | by the C<a>, C<mx>, C<ptr>, and C<exists> mechanisms and the C<p> macro. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | A value of B<2> is likely to prevent effective DoS attacks against third-party | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | victim domains. However, a definite limit may cause C<permerror> results even | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | with certain (overly complex) innocent sender policies where useful results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | would normally be returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 21 | my ($self, %options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 21 | $self = $self->SUPER::new(%options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # Do not cache a Mail::SPF::MacroString instance with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # context provided, this causes a circular reference that leaks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # both objects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | $self->{default_authority_explanation} = $self->default_default_authority_explanation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 21 | ▶ | if not defined($self->{default_authority_explanation}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 21 | ▶ | $self->{hostname} ||= Mail::SPF::Util->hostname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"hostname"} ||= "Mail::SPF::Util"->hostname
MC/DC0%0/2
$self->{"hostname"} ||= "Mail::SPF::Util"->hostname
$self->{"hostname"}
"Mail::SPF::Util"->hostname
Truth table66%2/3
A ||= B
A= $self->{"hostname"}B= "Mail::SPF::Util"->hostname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 21 | ▶ | $self->{dns_resolver} ||= Net::DNS::Resolver->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"dns_resolver"} ||= "Net::DNS::Resolver"->new
MC/DC0%0/2
$self->{"dns_resolver"} ||= "Net::DNS::Resolver"->new
$self->{"dns_resolver"}
"Net::DNS::Resolver"->new
Truth table66%2/3
A ||= B
A= $self->{"dns_resolver"}B= "Net::DNS::Resolver"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | $self->{query_rr_types} = $self->default_query_rr_types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 21 | ▶ | if not defined($self->{query_rr_types}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | $self->{max_dns_interactive_terms} = $self->default_max_dns_interactive_terms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 21 | ▶ | if not exists($self->{max_dns_interactive_terms}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | $self->{max_name_lookups_per_term} = $self->default_max_name_lookups_per_term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 21 | ▶ | if not exists($self->{max_name_lookups_per_term}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | $self->{max_name_lookups_per_mx_mech} = $self->default_max_name_lookups_per_mx_mech | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 21 | ▶ | if not exists($self->{max_name_lookups_per_mx_mech}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | $self->{max_name_lookups_per_ptr_mech} = $self->default_max_name_lookups_per_ptr_mech | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 21 | ▶ | if not exists($self->{max_name_lookups_per_ptr_mech}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | $self->{max_void_dns_lookups} = $self->default_max_void_dns_lookups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 21 | ▶ | if not exists($self->{max_void_dns_lookups}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 21 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | =head2 Class methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | The following class methods are provided: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =item B<result_class>: returns I<class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | =item B<result_class($name)>: returns I<class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | Returns a I<Mail::SPF::Result> descendent class determined from the given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | result name via the server's inherent result base class, or returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | server's inherent result base class if no result name is given. This method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | may also be used as an instance method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | I<Note>: Do not write code invoking class methods on I<literal> result class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | names as this would ignore any derivative result classes provided by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | B<Mail::SPF> extension modules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 44 | ▶ | sub result_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_class: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 44 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | defined($name) ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 44 | ▶ | $self->result_base_class->result_classes->{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | : $self->result_base_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | =item B<throw_result($name, $request)>: throws I<Mail::SPF::Result> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =item B<throw_result($name, $request, $text)>: throws I<Mail::SPF::Result> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | Throws a I<Mail::SPF::Result> descendant determined from the given result name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | via the server's inherent result base class, passing an optional result text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | and associating the given I<Mail::SPF::Request> object with the result object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | This method may also be used as an instance method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | I<Note>: Do not write code invoking C<throw> on I<literal> result class names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | as this would ignore any derivative result classes provided by B<Mail::SPF> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | extension modules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 4 | ▶ | sub throw_result { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throw_result: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 4 | my ($self, $name, $request, @text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 4 | $self->result_class($name)->throw($self, $request, @text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | =head2 Instance methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | The following instance methods are provided: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | =item B<process($request, $options)>: returns I<Mail::SPF::Result> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Processes the given I<Mail::SPF::Request> object, queries the authoritative | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | domain for an SPF sender policy (see the description of the L</select_record> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | method), evaluates the policy with regard to the given identity and other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | request parameters, and returns a I<Mail::SPF::Result> object denoting the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | result of the policy evaluation. See RFC 4408, 4, and RFC 4406, 4, for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | An optional I<hash> reference of options may be given as the second argument. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | Currently the only supported option is: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | =item B<record> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | A I<string> denoting a proposed SPF record to evaluate I<instead of> querying | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | DNS for the authority domain's record. This allows testing a not-yet- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | published record against the real DNS state of any domains it references | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | (e.g. via C<include> or C<a>/C<mx>), without first having to publish it. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | the description of the L</record_from_string> method for details of how the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | record is parsed and validated. As with a published record, the result is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | C<none> without any DNS queries if the identity's domain is malformed or a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | single-label domain name (see L</select_record>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 40 | ▶ | sub process { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 40 | my ($self, $request, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 40 | ▶ | $options ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options ||= {}
MC/DC100%1/1
$options ||= {}
$options
Truth table100%2/2
A
A= $options
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 40 | $request->state('authority_explanation', undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 40 | $request->state('dns_interactive_terms_count', 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 40 | $request->state('void_dns_lookups_count', 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 40 | $request->state('p_macro_cache', {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 40 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 40 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 40 | my $record; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 40 | ▶ | if (defined($options->{record})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # As for a published record, a malformed identity domain has none: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 8 | $self->_check_authority_domain($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 5 | $record = $self->record_from_string($options->{record}, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 32 | $record = $self->select_record($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 27 | $request->record($record); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 27 | $record->eval($self, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 26 | ▶ | catch Mail::SPF::Result with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 26 | $result = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 2 | ▶ | catch Mail::SPF::EDNSError with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | $result = $self->result_class('temperror')->new($self, $request, shift->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 11 | ▶ | catch Mail::SPF::ENoAcceptableRecord with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 11 | $result = $self->result_class('none' )->new($self, $request, shift->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | catch Mail::SPF::ERedundantAcceptableRecords with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $result = $self->result_class('permerror')->new($self, $request, shift->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | ▶ | catch Mail::SPF::ESyntaxError with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | $result = $self->result_class('permerror')->new($self, $request, shift->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | catch Mail::SPF::EProcessingLimitExceeded with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $result = $self->result_class('permerror')->new($self, $request, shift->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # Propagate other, unknown errors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # This should not happen, but if it does, it helps exposing the bug! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 40 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | =item B<select_record($request)>: returns I<Mail::SPF::Record>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | throws I<Mail::SPF::EDNSError>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | I<Mail::SPF::ENoAcceptableRecord>, I<Mail::SPF::ERedundantAcceptableRecords>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | I<Mail::SPF::ESyntaxError> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | Queries the authority domain of the given I<Mail::SPF::Request> object for SPF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | sender policy records and, if multiple records are available, selects the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | record of the lowest acceptable record version that covers the requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | scope, i.e. a C<v=spf1> record is preferred over an C<spf2.0> record. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | Note that this deliberately deviates from RFC 4406 (Sender ID), 4.4/6, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | prefers C<spf2.0> records. Sender ID is historic (RFC 6686), so C<v=spf1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | records are the ones that are maintained, and are used whenever available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | More precisely, the following algorithm is performed (assuming that both C<TXT> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | and C<SPF> RR types are being queried): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | =item 1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | Determine the authority domain, the set of acceptable SPF record versions, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | the identity scope from the given request object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | If the authority domain is taken from the identity (rather than from macro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | expansion, as for an C<include> mechanism or C<redirect> modifier) and is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | malformed or a single-label domain name, throw a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | I<Mail::SPF::ENoAcceptableRecord> exception without querying DNS (RFC 7208, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 4.3). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | =item 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | Query the authority domain for SPF records of the C<SPF> DNS RR type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | discarding any records that are of an inacceptable version or do not cover the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | desired scope. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | If this yields no SPF records, query the authority domain for SPF records of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | the C<TXT> DNS RR type, discarding any records that are of an inacceptable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | version or do not cover the desired scope. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | If still no acceptable SPF records could be found, throw a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | I<Mail::SPF::ENoAcceptableRecord> exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | =item 3. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | Discard all records but those of the lowest acceptable version found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | If exactly one record remains, return it. Otherwise, throw a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | I<Mail::SPF::ERedundantAcceptableRecords> exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | If the querying of either RR type has been disabled via the L</new> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | constructor's C<query_rr_types> option, the respective part in step 2 will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | be skipped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | I<Mail::SPF::EDNSError> exceptions due to DNS look-ups and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | I<Mail::SPF::ESyntaxError> exceptions due to invalid acceptable records may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | also be thrown. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 35 | ▶ | sub select_record { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_record: called CC=9 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 35 | my ($self, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 35 | my $domain = $request->authority_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 35 | my @versions = $request->versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 35 | my $scope = $request->scope; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 35 | $self->_check_authority_domain($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # Employ identical behavior for 'v=spf1' and 'spf2.0' records, both of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # which support SPF (code 99) and TXT type records (this may be different | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # in future revisions of SPF): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # Query for SPF type records first, then fall back to TXT type records. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 29 | my @records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 29 | my $query_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 29 | my @dns_errors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # Query for SPF-type RRs first: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 29 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->query_rr_types == $self->query_rr_type_all or $self->query_rr_types & $self->query_rr_type_spf
MC/DC0%0/2
$self->query_rr_types == $self->query_rr_type_all or $self->query_rr_types & $self->query_rr_type_spf
$self->query_rr_types == $self->query_rr_type_all
$self->query_rr_types & $self->query_rr_type_spf
Truth table33%1/3
A or B
A= $self->query_rr_types == $self->query_rr_type_allB= $self->query_rr_types & $self->query_rr_type_spf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | $self->query_rr_types == $self->query_rr_type_all or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | $self->query_rr_types & $self->query_rr_type_spf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $query_count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $packet = $self->dns_lookup($domain, 'SPF'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | push( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | @records, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | $self->get_acceptable_records_from_packet( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | $packet, 'SPF', \@versions, $scope, $domain) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | catch Mail::SPF::EDNSError with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | push(@dns_errors, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | #catch Mail::SPF::EDNSTimeout with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # # FIXME Ignore DNS time-outs on SPF type lookups? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | # # Apparrently some brain-dead DNS servers time out on SPF-type queries. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # If no usable SPF-type RRs, try TXT-type RRs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 29 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not @records and $self->query_rr_types == $self->query_rr_type_all || $self->query_rr_types & $self->query_rr_type_txt
$self->query_rr_types == $self->query_rr_type_all or $self->query_rr_types & $self->query_rr_type_txt
MC/DC0%0/3
not @records and $self->query_rr_types == $self->query_rr_type_all || $self->query_rr_types & $self->query_rr_type_txt
not @records
$self->query_rr_types == $self->query_rr_type_all
$self->query_rr_types & $self->query_rr_type_txt
Truth table25%1/4
not(A) and B or C
A= not @recordsB= $self->query_rr_types == $self->query_rr_type_allC= $self->query_rr_types & $self->query_rr_type_txt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | not @records and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | $self->query_rr_types == $self->query_rr_type_all or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | $self->query_rr_types & $self->query_rr_type_txt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # NOTE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # This deliberately violates RFC 4406 (Sender ID), 4.4/3 (4.4.1): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # TXT-type RRs are still tried if there _are_ SPF-type RRs but all of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # them are inapplicable (i.e. "Hi!", or even "spf2.0/pra" for an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # 'mfrom' scope request). This conforms to the spirit of the more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # sensible algorithm in RFC 4408 (SPF), 4.5. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # Implication: Sender ID processing may make use of existing TXT- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # type records where a result of "None" would normally be returned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | # under a strict interpretation of RFC 4406. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 29 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 29 | $query_count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 29 | my $packet = $self->dns_lookup($domain, 'TXT'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 28 | push( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | @records, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | $self->get_acceptable_records_from_packet( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | $packet, 'TXT', \@versions, $scope, $domain) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | ▶ | catch Mail::SPF::EDNSError with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | push(@dns_errors, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 29 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 29 | ▶ | @dns_errors < $query_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | or $dns_errors[0]->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | # Unless at least one query succeeded, re-throw the first DNS error that occurred. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | @records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 28 | ▶ | or throw Mail::SPF::ENoAcceptableRecord( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | "No applicable sender policy available"); # RFC 4408, 4.5/7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # Discard all records but those of the lowest acceptable version, i.e. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | # prefer 'v=spf1' over 'spf2.0' (Sender ID, which is historic, see RFC 6686), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # regardless of the order of the RRs in the DNS answer: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | my ($preferred_record_class) = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 53 | my $class = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 53 | grep($_->isa($class), @records); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 27 | } map($self->record_classes_by_version->{$_}, sort { $a <=> $b } @versions); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 27 | @records = grep($_->isa($preferred_record_class), @records); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 27 | ▶ | @records == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | or throw Mail::SPF::ERedundantAcceptableRecords( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | "Redundant applicable '" . $preferred_record_class->version_tag . "' " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | "sender policies found"); # RFC 4408, 4.5/6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 27 | return $records[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 43 | ▶ | sub _check_authority_domain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_authority_domain: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 43 | my ($self, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 43 | my $domain = $request->authority_domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # A malformed or single-label identity domain (e.g. from "MAIL FROM:<a@>" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # or "HELO localhost") has no sender policy, and must not be queried, as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # the resolver may expand it with its search list (RFC 7208, 4.3). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | # Domains from macro expansion are handled by dns_lookup() (RFC 7208, 7.3): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 43 | ▶ | if (not UNIVERSAL::isa($domain, 'Mail::SPF::MacroString')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | # An authority_domain passed to Mail::SPF::Request may be fully | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # qualified, i.e. end in a dot (as dns_lookup() allows): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 37 | $domain =~ s/\.$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 37 | ▶ | $domain =~ /^[^.]+(?:\.[^.]+)+$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$domain =~ /^[^.]+(?:\.[^.]+)+$/ and not $domain =~ /[^.]{64}/ and length $domain <= 253
$domain =~ /^[^.]+(?:\.[^.]+)+$/ and not $domain =~ /[^.]{64}/
MC/DC66%2/3
$domain =~ /^[^.]+(?:\.[^.]+)+$/ and not $domain =~ /[^.]{64}/ and length $domain <= 253
$domain =~ /^[^.]+(?:\.[^.]+)+$/
not $domain =~ /[^.]{64}/
length $domain <= 253
Truth table75%3/4
A and not(B) and C
A= $domain =~ /^[^.]+(?:\.[^.]+)+$/B= not $domain =~ /[^.]{64}/C= length $domain <= 253
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | and $domain !~ /[^.]{64}/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | and length($domain) <= 253 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | or throw Mail::SPF::ENoAcceptableRecord( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | "Malformed or single-label domain name '$domain'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 34 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | =item B<get_acceptable_records_from_packet($packet, $rr_type, \@versions, $scope, $domain)>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | returns I<list> of I<Mail::SPF::Record> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | Filters from the given I<Net::DNS::Packet> object all resource records of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | given RR type and for the given domain name, discarding any records that are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | not SPF records at all, that are of an inacceptable SPF record version, or that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | do not cover the given scope. Returns a list of acceptable records. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 28 | ▶ | sub get_acceptable_records_from_packet { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_acceptable_records_from_packet: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 28 | my ($self, $packet, $rr_type, $versions, $scope, $domain) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 28 | my @records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 28 | foreach my $rr ($packet->answer) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 33 | ▶ | next if $rr->type ne $rr_type; # Ignore RRs of unexpected type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | # char_str_list method is 'historical', use as a fallback for Net::DNS prior to 0.69 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | # where txtdata is not available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # join with no intervening spaces, RFC 6376 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | # must call txtdata() in a list context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 30 | ▶ | my $text = $rr->can('txtdata') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | ? join('', $rr->txtdata) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | : join('', $rr->char_str_list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 30 | my $record = $self->parse_record_for_versions($text, $versions); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 30 | ▶ | push(@records, $record) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $record and grep(($scope eq $_), $record->scopes)
MC/DC50%1/2
defined $record and grep(($scope eq $_), $record->scopes)
defined $record
grep(($scope eq $_), $record->scopes)
Truth table66%2/3
A and B
A= defined $recordB= grep(($scope eq $_), $record->scopes)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | if defined($record) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | and grep($scope eq $_, $record->scopes); # record covers requested scope? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 28 | return @records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | =item B<parse_record_for_versions($text, \@versions)>: returns I<Mail::SPF::Record> or B<undef>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | throws I<Mail::SPF::ESyntaxError> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | Tries to parse the given string as an SPF record of each of the given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | versions, preferring version 1 (C<v=spf1>) over version 2 (C<spf2.0>, i.e. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | Sender ID, which is deprecated), and returns the first successfully parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | record. Records that are not SPF records at all, or that are of an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | unrequested version, are ignored, in which case B<undef> is returned. Other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | parse errors, e.g. I<Mail::SPF::ESyntaxError>, are propagated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 35 | ▶ | sub parse_record_for_versions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_record_for_versions: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 35 | my ($self, $text, $versions) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 35 | my @versions = sort { $a <=> $b } @$versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # Prefer SPF1 records; spf2.0 (Sender ID) is deprecated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 35 | my $record; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | VERSION: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 35 | foreach my $version (@versions) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 37 | my $class = $self->record_classes_by_version->{$version}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 37 | eval("require $class"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 37 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 37 | $record = $class->new_from_string($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 37 | ▶ | catch Mail::SPF::EInvalidRecordVersion with {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # Ignore non-SPF and unknown-version records. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # Propagate other errors (including syntax errors), though. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 36 | ▶ | last VERSION if defined($record); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 34 | return $record; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | =item B<record_from_string($text, $request)>: returns I<Mail::SPF::Record>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | throws I<Mail::SPF::ENoAcceptableRecord>, I<Mail::SPF::ESyntaxError> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | Parses the given string as an SPF record of one of the acceptable versions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | for the given I<Mail::SPF::Request> object, preferring version 1 over version 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | (see L</parse_record_for_versions>), without performing any DNS look-up. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | Throws a I<Mail::SPF::ENoAcceptableRecord> exception if the text does not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | parse as an acceptable record version, or if the resulting record does not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | cover the request's scope. Used by L</process> to evaluate a proposed record | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | supplied via its C<record> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 5 | ▶ | sub record_from_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
record_from_string: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 5 | my ($self, $text, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 5 | my @versions = $request->versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 5 | my $scope = $request->scope; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 5 | my $record = $self->parse_record_for_versions($text, \@versions); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 4 | ▶ | defined($record) && grep($scope eq $_, $record->scopes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $record and grep(($scope eq $_), $record->scopes)
MC/DC50%1/2
defined $record and grep(($scope eq $_), $record->scopes)
defined $record
grep(($scope eq $_), $record->scopes)
Truth table66%2/3
A and B
A= defined $recordB= grep(($scope eq $_), $record->scopes)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | or throw Mail::SPF::ENoAcceptableRecord( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | "Proposed record is not an acceptable sender policy for the '$scope' scope"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 3 | return $record; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | =item B<dns_lookup($domain, $rr_type)>: returns I<Net::DNS::Packet>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | throws I<Mail::SPF::EDNSTimeout>, I<Mail::SPF::EDNSError> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | Queries the DNS using the configured resolver for resource records of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | desired type at the specified domain and returns a I<Net::DNS::Packet> object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | if an answer packet was received. Throws a I<Mail::SPF::EDNSTimeout> exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | if a DNS time-out occurred. Throws a I<Mail::SPF::EDNSError> exception if an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | error (other than RCODE 3 AKA C<NXDOMAIN>) occurred, including if the resolver | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | throws an exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | A domain that is not a valid DNS name (i.e. has an empty label, a label longer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | than 63 bytes, or is longer than 253 bytes) is treated as non-existent without | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | querying the resolver, and an empty C<NXDOMAIN> answer packet is returned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | (RFC 7208, 4.3/1, 4.8/5). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 64 | ▶ | sub dns_lookup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dns_lookup: called CC=11 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 64 | my ($self, $domain, $rr_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 64 | my $packet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 64 | ▶ | if (UNIVERSAL::isa($domain, 'Mail::SPF::MacroString')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 19 | $domain = $domain->expand; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | # Truncate overlong labels at 63 bytes (RFC 4408, 8.1/27): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 19 | $domain =~ s/([^.]{63})[^.]+/$1/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | # Drop labels from the head of domain if longer than 253 bytes (RFC 4408, 8.1/25): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 19 | ▶ | $domain =~ s/^[^.]+\.(.*)$/$1/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | while length($domain) > 253; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 64 | $domain =~ s/^(.*?)\.?$/\L$1/; # Normalize domain. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | # Treat invalid domain names as non-existent (RFC 7208, 4.3/1, 4.8/5), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | # as no DNS query can be composed from them. Also check the name the way | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | # Net::DNS composes the query, as it reads escapes (e.g. "\."), and counts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # bytes of labels encoded as UTF-8 (or IDN), so that a sender cannot make | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | # it fail (and so cause a temperror) with a name that passes the checks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 64 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$domain =~ /^\.|\.\./ or $domain =~ /[^.]{64}/ or length $domain > 253 or not eval {
do {
length "Net::DNS::DomainName"->new($domain)->encode <= 255
}
}
$domain =~ /^\.|\.\./ or $domain =~ /[^.]{64}/ or length $domain > 253
$domain =~ /^\.|\.\./ or $domain =~ /[^.]{64}/
MC/DC100%4/4
$domain =~ /^\.|\.\./ or $domain =~ /[^.]{64}/ or length $domain > 253 or not eval {
do {
length "Net::DNS::DomainName"->new($domain)->encode <= 255
}
}
$domain =~ /^\.|\.\./
$domain =~ /[^.]{64}/
length $domain > 253
not eval {
do {
length "Net::DNS::DomainName"->new($domain)->encode <= 255
}
}
Truth table100%5/5
A or B or C or not(D)
A= $domain =~ /^\.|\.\./B= $domain =~ /[^.]{64}/C= length $domain > 253D= not eval {
do {
length "Net::DNS::DomainName"->new($domain)->encode <= 255
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | $domain =~ /^\.|\.\./ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | $domain =~ /[^.]{64}/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | length($domain) > 253 or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | have_net_dns_domainname and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 59 | not eval { length(Net::DNS::DomainName->new($domain)->encode) <= 255 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 10 | $packet = Net::DNS::Packet->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 10 | $packet->header->rcode('NXDOMAIN'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 10 | return $packet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 54 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 54 | $packet = $self->dns_resolver->send($domain, $rr_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 3 | ▶ | otherwise { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # Don't include the resolver's exception text, which may reveal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # internal details, as this may end up in a Received-SPF header: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 3 | throw Mail::SPF::EDNSError("Unknown error on DNS '$rr_type' lookup of '$domain'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # Throw DNS exception unless an answer packet with RCODE 0 or 3 (NXDOMAIN) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # was received (thereby treating NXDOMAIN as an acceptable but empty answer packet): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 51 | ▶ | throw Mail::SPF::EDNSTimeout("Time-out on DNS '$rr_type' lookup of '$domain'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->dns_resolver->errorstring and $self->dns_resolver->errorstring =~ /^(timeout|query timed out)$/
MC/DC0%0/2
defined $self->dns_resolver->errorstring and $self->dns_resolver->errorstring =~ /^(timeout|query timed out)$/
defined $self->dns_resolver->errorstring
$self->dns_resolver->errorstring =~ /^(timeout|query timed out)$/
Truth table33%1/3
A and B
A= defined $self->dns_resolver->errorstringB= $self->dns_resolver->errorstring =~ /^(timeout|query timed out)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | if defined $self->dns_resolver->errorstring && $self->dns_resolver->errorstring =~ /^(timeout|query timed out)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 51 | ▶ | throw Mail::SPF::EDNSError("Unknown error on DNS '$rr_type' lookup of '$domain'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | unless defined $packet; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 51 | ▶ | throw Mail::SPF::EDNSError("'" . $packet->header->rcode . "' error on DNS '$rr_type' lookup of '$domain'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | unless $packet->header->rcode =~ /^(NOERROR|NXDOMAIN)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 50 | return $packet; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | =item B<count_dns_interactive_term($request)>: throws I<Mail::SPF::EProcessingLimitExceeded> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | Increments by one the count of DNS-interactive mechanisms and modifiers that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | have been processed so far during the evaluation of the given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | I<Mail::SPF::Request> object. If this exceeds the configured limit (see the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | L</new> constructor's C<max_dns_interactive_terms> option), throws a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | I<Mail::SPF::EProcessingLimitExceeded> exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | This method is supposed to be called by the C<match> and C<process> methods of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | I<Mail::SPF::Mech> and I<Mail::SPF::Mod> sub-classes before (and only if) they | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | do any DNS look-ups. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 18 | ▶ | sub count_dns_interactive_term { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count_dns_interactive_term: called CC=3 SCAR=12.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 18 | my ($self, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 18 | my $dns_interactive_terms_count = ++$request->root_request->state('dns_interactive_terms_count'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 18 | my $max_dns_interactive_terms = $self->max_dns_interactive_terms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 18 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $max_dns_interactive_terms and $dns_interactive_terms_count > $max_dns_interactive_terms
MC/DC0%0/2
defined $max_dns_interactive_terms and $dns_interactive_terms_count > $max_dns_interactive_terms
defined $max_dns_interactive_terms
$dns_interactive_terms_count > $max_dns_interactive_terms
Truth table33%1/3
A and B
A= defined $max_dns_interactive_termsB= $dns_interactive_terms_count > $max_dns_interactive_terms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | defined($max_dns_interactive_terms) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | $dns_interactive_terms_count > $max_dns_interactive_terms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | throw Mail::SPF::EProcessingLimitExceeded( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | "Maximum DNS-interactive terms limit ($max_dns_interactive_terms) exceeded"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | =item B<count_void_dns_lookup($request)>: throws I<Mail::SPF::EProcessingLimitExceeded> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | Increments by one the count of "void" DNS look-ups that have occurred so far | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | during the evaluation of the given I<Mail::SPF::Request> object. If this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | exceeds the configured limit (see the L</new> constructor's C<max_void_dns_lookups> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | option), throws a I<Mail::SPF::EProcessingLimitExceeded> exception. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | This method is supposed to be called by any code after any calls to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | L</dns_lookup> method whenever (i) no answer records were returned, and (ii) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | this fact is a possible indication of a DoS attack against a third-party victim | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | domain, and (iii) the number of "void" look-ups is not already constrained | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | otherwise (as for example is the case with the C<include> mechanism and the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | C<redirect> modifier). Specifically, this applies to look-ups performed by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | C<a>, C<mx>, C<ptr>, and C<exists> mechanisms and the C<p> macro. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 7 | ▶ | sub count_void_dns_lookup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count_void_dns_lookup: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 7 | my ($self, $request) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 7 | my $void_dns_lookups_count = ++$request->root_request->state('void_dns_lookups_count'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 7 | my $max_void_dns_lookups = $self->max_void_dns_lookups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 7 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $max_void_dns_lookups and $void_dns_lookups_count > $max_void_dns_lookups
MC/DC50%1/2
defined $max_void_dns_lookups and $void_dns_lookups_count > $max_void_dns_lookups
defined $max_void_dns_lookups
$void_dns_lookups_count > $max_void_dns_lookups
Truth table66%2/3
A and B
A= defined $max_void_dns_lookupsB= $void_dns_lookups_count > $max_void_dns_lookups
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | defined($max_void_dns_lookups) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | $void_dns_lookups_count > $max_void_dns_lookups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 1 | throw Mail::SPF::EProcessingLimitExceeded( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | "Maximum void DNS look-ups limit ($max_void_dns_lookups) exceeded"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | =item B<default_authority_explanation>: returns I<Mail::SPF::MacroString> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | Returns the default authority explanation as a I<MacroString> object. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | description of the L</new> constructor's C<default_authority_explanation> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 6 | ▶ | sub default_authority_explanation { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_authority_explanation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | return Mail::SPF::MacroString->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | text => $self->{default_authority_explanation}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 6 | server => $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | is_explanation => TRUE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | =item B<hostname>: returns I<string> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | Returns the local system's host name. See the description of the L</new> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | constructor's C<hostname> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | =item B<dns_resolver>: returns I<Net::DNS::Resolver> or compatible object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | Returns the DNS resolver object of the server object. See the description of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | the L</new> constructor's C<dns_resolver> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | =item B<query_rr_types>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | Returns a value denoting the RR types for which to query when looking up and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | selecting SPF records. See the description of the L</new> constructor's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | C<query_rr_types> option. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | =item B<max_dns_interactive_terms>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | =item B<max_name_lookups_per_term>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | =item B<max_name_lookups_per_mx_mech>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | =item B<max_name_lookups_per_ptr_mech>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | =item B<max_void_dns_lookups>: returns I<integer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | Return the limit values of the server object. See the description of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | L</new> constructor's corresponding options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | # Make read-only accessors: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | __PACKAGE__->make_accessor($_, TRUE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 6 | foreach qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | hostname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | dns_resolver | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | query_rr_types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | max_dns_interactive_terms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | max_name_lookups_per_term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | max_name_lookups_per_mx_mech | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | max_name_lookups_per_ptr_mech | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | max_void_dns_lookups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | L<Mail::SPF>, L<Mail::SPF::Request>, L<Mail::SPF::Result> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | L<http://tools.ietf.org/html/rfc4408> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | For availability, support, and license information, see the README file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | included with Mail::SPF. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 6 | TRUE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||