line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Mail::SPF::Mech::PTR |
3
|
|
|
|
|
|
|
# SPF record "ptr" mechanism class. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# (C) 2005-2012 Julian Mehnle |
6
|
|
|
|
|
|
|
# 2005 Shevek |
7
|
|
|
|
|
|
|
# $Id: PTR.pm 57 2012-01-30 08:15:31Z julian $ |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
############################################################################## |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Mail::SPF::Mech::PTR; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Mail::SPF::Mech::PTR - SPF record C mechanism class |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
1012
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
20
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use base 'Mail::SPF::SenderIPAddrMech'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
4
|
use Mail::SPF::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
4
|
use constant TRUE => (0 == 0); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
27
|
1
|
|
|
1
|
|
4
|
use constant FALSE => not TRUE; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
4
|
use constant name => 'ptr'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
30
|
1
|
|
|
1
|
|
4
|
use constant name_pattern => qr/${\name}/i; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
216
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
An object of class B represents an SPF record mechanism |
35
|
|
|
|
|
|
|
of type C. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 Constructors |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The following constructors are provided: |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=over |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item B: returns I |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Creates a new SPF record C mechanism object. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
%options is a list of key/value pairs representing any of the following |
48
|
|
|
|
|
|
|
options: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item B |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item B |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
See L. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item B: returns I; |
61
|
|
|
|
|
|
|
throws I, I |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Creates a new SPF record C mechanism object by parsing the string and |
64
|
|
|
|
|
|
|
any options given. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 Class methods |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The following class methods are provided: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=over |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item B |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
See L. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item B: returns I |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns B<'ptr'>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item B: returns I |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a regular expression that matches a mechanism name of B<'ptr'>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 Instance methods |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The following instance methods are provided: |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub parse_params { |
99
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
100
|
0
|
|
|
|
|
|
$self->parse_domain_spec(); |
101
|
0
|
|
|
|
|
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item B |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item B |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item B |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub params { |
113
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
114
|
0
|
0
|
|
|
|
|
return defined($self->{domain_spec}) ? ':' . $self->{domain_spec} : undef; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item B |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
See L. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item B: returns I |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns the C parameter of the mechanism. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# Make read-only accessor: |
128
|
|
|
|
|
|
|
__PACKAGE__->make_accessor('domain_spec', TRUE); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item B: returns I |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Checks whether the mechanism's target domain name, or a sub-domain thereof, is |
133
|
|
|
|
|
|
|
a "valid" domain name for the given request's IP address (see |
134
|
|
|
|
|
|
|
L), and returns B if it does, or B |
135
|
|
|
|
|
|
|
otherwise. See L for how domains |
136
|
|
|
|
|
|
|
are validated. See RFC 4408, 5.5, for the description of an equivalent |
137
|
|
|
|
|
|
|
algorithm. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub match { |
142
|
0
|
|
|
0
|
1
|
|
my ($self, $server, $request) = @_; |
143
|
0
|
|
|
|
|
|
$server->count_dns_interactive_term($request); |
144
|
|
|
|
|
|
|
return |
145
|
0
|
0
|
|
|
|
|
Mail::SPF::Util->valid_domain_for_ip_address( |
146
|
|
|
|
|
|
|
$server, $request, $request->ip_address, $self->domain($server, $request)) |
147
|
|
|
|
|
|
|
? TRUE : FALSE; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SEE ALSO |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L, L, L, L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
L |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
For availability, support, and license information, see the README file |
159
|
|
|
|
|
|
|
included with Mail::SPF. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHORS |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Julian Mehnle , Shevek |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
TRUE; |