line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Mail::SPF::Mech::IP6 |
3
|
|
|
|
|
|
|
# SPF record "ip6" mechanism class. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# (C) 2005-2012 Julian Mehnle |
6
|
|
|
|
|
|
|
# 2005 Shevek |
7
|
|
|
|
|
|
|
# $Id: IP6.pm 57 2012-01-30 08:15:31Z julian $ |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
############################################################################## |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Mail::SPF::Mech::IP6; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Mail::SPF::Mech::IP6 - SPF record C mechanism class |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
980
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
20
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use base 'Mail::SPF::SenderIPAddrMech'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
4
|
use constant TRUE => (0 == 0); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
25
|
1
|
|
|
1
|
|
5
|
use constant FALSE => not TRUE; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
4
|
use constant name => 'ip6'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
52
|
|
28
|
1
|
|
|
1
|
|
4
|
use constant name_pattern => qr/${\name}/i; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
210
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
An object of class B represents an SPF record mechanism |
33
|
|
|
|
|
|
|
of type C. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 Constructors |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The following constructors are provided: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item B: returns I |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Creates a new SPF record C mechanism object. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
%options is a list of key/value pairs representing any of the following |
46
|
|
|
|
|
|
|
options: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item B |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item B |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
See L. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B: returns I; |
59
|
|
|
|
|
|
|
throws I, I |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Creates a new SPF record C mechanism object by parsing the string and |
62
|
|
|
|
|
|
|
any options given. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 Class methods |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The following class methods are provided: |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item B |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item B |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
See L. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item B: returns I |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns B<'ip6'>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item B: returns I |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a regular expression that matches a mechanism name of B<'ip6'>. |
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_ipv6_network(TRUE); |
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
|
|
|
|
|
|
my $params = ':' . $self->{ip_network}->short; |
115
|
0
|
0
|
|
|
|
|
$params .= '/' . $self->{ip_network}->masklen |
116
|
|
|
|
|
|
|
if $self->{ip_network}->masklen != $self->default_ipv6_prefix_length; |
117
|
0
|
|
|
|
|
|
return $params; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item B |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See L. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item B: returns I |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns the IP address network parameter of the mechanism. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Make read-only accessors: |
131
|
|
|
|
|
|
|
__PACKAGE__->make_accessor($_, TRUE) |
132
|
|
|
|
|
|
|
foreach qw(ip_network ip_address ipv6_prefix_length); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item B: returns I |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns B if the mechanism's C equals or contains the given |
137
|
|
|
|
|
|
|
request's IP address, or B otherwise. See RFC 4408, 5.6, for details. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub match { |
142
|
0
|
|
|
0
|
1
|
|
my ($self, $server, $request) = @_; |
143
|
0
|
|
|
|
|
|
return $self->ip_network->contains($request->ip_address_v6); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=back |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 SEE ALSO |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L, L, L, L |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
For availability, support, and license information, see the README file |
155
|
|
|
|
|
|
|
included with Mail::SPF. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 AUTHORS |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Julian Mehnle , Shevek |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
TRUE; |