line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2021 by [Mark Overmeer ]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of distribution Mail-Message. Meta-POD processed with |
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Mail::Message::Field::AuthResults; |
10
|
21
|
|
|
21
|
|
1015
|
use vars '$VERSION'; |
|
21
|
|
|
|
|
52
|
|
|
21
|
|
|
|
|
1326
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.011'; |
12
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
398
|
use base 'Mail::Message::Field::Structured'; |
|
21
|
|
|
|
|
106
|
|
|
21
|
|
|
|
|
3045
|
|
14
|
|
|
|
|
|
|
|
15
|
21
|
|
|
21
|
|
156
|
use warnings; |
|
21
|
|
|
|
|
50
|
|
|
21
|
|
|
|
|
828
|
|
16
|
21
|
|
|
21
|
|
154
|
use strict; |
|
21
|
|
|
|
|
56
|
|
|
21
|
|
|
|
|
694
|
|
17
|
|
|
|
|
|
|
|
18
|
21
|
|
|
21
|
|
12127
|
use URI; |
|
21
|
|
|
|
|
99024
|
|
|
21
|
|
|
|
|
44622
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init($) |
23
|
9
|
|
|
9
|
0
|
34
|
{ my ($self, $args) = @_; |
24
|
9
|
|
|
|
|
116
|
$self->{MMFA_server} = delete $args->{server}; |
25
|
9
|
|
|
|
|
47
|
$self->{MMFA_version} = delete $args->{version}; |
26
|
|
|
|
|
|
|
|
27
|
9
|
|
|
|
|
31
|
$self->{MMFA_results} = []; |
28
|
9
|
50
|
|
|
|
23
|
$self->addResult($_) for @{delete $args->{results} || []}; |
|
9
|
|
|
|
|
75
|
|
29
|
|
|
|
|
|
|
|
30
|
9
|
|
|
|
|
62
|
$self->SUPER::init($args); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub parse($) |
34
|
8
|
|
|
8
|
1
|
26
|
{ my ($self, $string) = @_; |
35
|
8
|
|
|
|
|
80
|
$string =~ s/\r?\n/ /g; |
36
|
|
|
|
|
|
|
|
37
|
8
|
|
|
|
|
47
|
(undef, $string) = $self->consumeComment($string); |
38
|
8
|
100
|
|
|
|
73
|
$self->{MMFA_server} = $string =~ s/^\s*([.\w-]*\w)// ? $1 : 'unknown'; |
39
|
|
|
|
|
|
|
|
40
|
8
|
|
|
|
|
33
|
(undef, $string) = $self->consumeComment($string); |
41
|
8
|
100
|
|
|
|
48
|
$self->{MMFA_version} = $string =~ s/^\s*([0-9]+)// ? $1 : 1; |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
|
|
|
25
|
(undef, $string) = $self->consumeComment($string); |
44
|
8
|
|
|
|
|
52
|
$string =~ s/^.*?\;/;/; # remove accidents |
45
|
|
|
|
|
|
|
|
46
|
8
|
|
|
|
|
24
|
my @results; |
47
|
8
|
|
|
|
|
53
|
while( $string =~ s/^\s*\;// ) |
48
|
|
|
|
|
|
|
{ |
49
|
12
|
|
|
|
|
39
|
(undef, $string) = $self->consumeComment($string); |
50
|
12
|
100
|
|
|
|
60
|
if($string =~ s/^\s*none//) |
51
|
3
|
|
|
|
|
13
|
{ (undef, $string) = $self->consumeComment($string); |
52
|
3
|
|
|
|
|
16
|
next; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
9
|
|
|
|
|
40
|
my %result; |
56
|
9
|
|
|
|
|
28
|
push @results, \%result; |
57
|
|
|
|
|
|
|
|
58
|
9
|
50
|
|
|
|
49
|
$string =~ s/^\s*([\w-]*\w)// or next; |
59
|
9
|
|
|
|
|
35
|
$result{method} = $1; |
60
|
|
|
|
|
|
|
|
61
|
9
|
|
|
|
|
26
|
(undef, $string) = $self->consumeComment($string); |
62
|
9
|
100
|
|
|
|
37
|
if($string =~ s!^\s*/!!) |
63
|
1
|
|
|
|
|
4
|
{ (undef, $string) = $self->consumeComment($string); |
64
|
1
|
50
|
|
|
|
8
|
$result{method_version} = $1 if $string =~ s/^\s*([0-9]+)//; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
9
|
|
|
|
|
27
|
(undef, $string) = $self->consumeComment($string); |
68
|
9
|
50
|
|
|
|
46
|
if($string =~ s/^\s*\=//) |
69
|
9
|
|
|
|
|
26
|
{ (undef, $string) = $self->consumeComment($string); |
70
|
9
|
50
|
|
|
|
70
|
$result{result} = $1 |
71
|
|
|
|
|
|
|
if $string =~ s/^\s*(\w+)//; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
9
|
|
|
|
|
30
|
(my $comment, $string) = $self->consumeComment($string); |
75
|
9
|
100
|
|
|
|
28
|
if($comment) |
76
|
3
|
|
|
|
|
10
|
{ $result{comment} = $comment; |
77
|
3
|
|
|
|
|
13
|
(undef, $string) = $self->consumeComment($string); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
9
|
100
|
|
|
|
57
|
if($string =~ s/\s*reason//) |
81
|
2
|
|
|
|
|
6
|
{ (undef, $string) = $self->consumeComment($string); |
82
|
2
|
50
|
|
|
|
13
|
if($string =~ s/\s*\=//) |
83
|
2
|
|
|
|
|
7
|
{ (undef, $string) = $self->consumeComment($string); |
84
|
2
|
0
|
33
|
|
|
20
|
$result{reason} = $1 |
|
|
|
33
|
|
|
|
|
85
|
|
|
|
|
|
|
if $string =~ s/^\"([^"]*)\"// |
86
|
|
|
|
|
|
|
|| $string =~ s/^\'([^']*)\'// |
87
|
|
|
|
|
|
|
|| $string =~ s/^(\w+)//; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
9
|
|
|
|
|
45
|
while($string =~ /\S/) |
92
|
13
|
|
|
|
|
32
|
{ (undef, $string) = $self->consumeComment($string); |
93
|
13
|
100
|
|
|
|
59
|
last if $string =~ /^\s*\;/; |
94
|
|
|
|
|
|
|
|
95
|
9
|
100
|
|
|
|
130
|
my $ptype = $string =~ s/^\s*([\w-]+)// ? $1 : last; |
96
|
8
|
|
|
|
|
30
|
(undef, $string) = $self->consumeComment($string); |
97
|
|
|
|
|
|
|
|
98
|
8
|
|
|
|
|
20
|
my ($property, $value); |
99
|
8
|
50
|
|
|
|
47
|
if($string =~ s/^\s*\.//) |
100
|
8
|
|
|
|
|
25
|
{ (undef, $string) = $self->consumeComment($string); |
101
|
8
|
50
|
|
|
|
46
|
$property = $string =~ s/^\s*([\w-]+)// ? $1 : last; |
102
|
8
|
|
|
|
|
23
|
(undef, $string) = $self->consumeComment($string); |
103
|
8
|
50
|
|
|
|
55
|
if($string =~ s/^\s*\=//) |
104
|
8
|
|
|
|
|
26
|
{ (undef, $string) = $self->consumeComment($string); |
105
|
8
|
|
|
|
|
26
|
$string =~ s/^\s+//; |
106
|
8
|
50
|
33
|
|
|
73
|
$string =~ s/^\"([^"]*)\"// |
|
|
|
33
|
|
|
|
|
107
|
|
|
|
|
|
|
|| $string =~ s/^\'([^']*)\'// |
108
|
|
|
|
|
|
|
|| $string =~ s/^([\w@.-]+)// |
109
|
|
|
|
|
|
|
or last; |
110
|
|
|
|
|
|
|
|
111
|
8
|
|
|
|
|
26
|
$value = $1; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
8
|
50
|
|
|
|
22
|
if(defined $value) |
116
|
8
|
|
|
|
|
47
|
{ $result{"$ptype.$property"} = $value; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
else |
119
|
0
|
|
|
|
|
0
|
{ $string =~ s/^.*?\;/;/g; # recover from parser problem |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
8
|
|
|
|
|
41
|
$self->addResult($_) for @results; |
124
|
|
|
|
|
|
|
|
125
|
8
|
|
|
|
|
26
|
$self; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub produceBody() |
129
|
3
|
|
|
3
|
1
|
7
|
{ my $self = shift; |
130
|
3
|
|
|
|
|
9
|
my $source = $self->server; |
131
|
3
|
|
|
|
|
9
|
my $version = $self->version; |
132
|
3
|
50
|
|
|
|
9
|
$source .= " $version" if $version!=1; |
133
|
|
|
|
|
|
|
|
134
|
3
|
|
|
|
|
6
|
my @results; |
135
|
3
|
|
|
|
|
9
|
foreach my $r ($self->results) |
136
|
3
|
|
|
|
|
7
|
{ my $method = $r->{method}; |
137
|
|
|
|
|
|
|
$method .= "/$r->{method_version}" |
138
|
3
|
100
|
|
|
|
11
|
if $r->{method_version} != 1; |
139
|
|
|
|
|
|
|
|
140
|
3
|
|
|
|
|
8
|
my $result = "$method=$r->{result}"; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$result .= ' ' . $self->createComment($r->{comment}) |
143
|
3
|
100
|
|
|
|
18
|
if defined $r->{comment}; |
144
|
|
|
|
|
|
|
|
145
|
3
|
50
|
|
|
|
9
|
if(my $reason = $r->{reason}) |
146
|
0
|
|
|
|
|
0
|
{ $reason =~ s/"/\\"/g; |
147
|
0
|
|
|
|
|
0
|
$result .= qq{ reason="$reason"}; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
3
|
|
|
|
|
17
|
foreach my $prop (sort keys %$r) |
151
|
12
|
100
|
|
|
|
30
|
{ index($prop, '.') > -1 or next; |
152
|
2
|
|
|
|
|
5
|
my $value = $r->{$prop}; |
153
|
2
|
|
|
|
|
5
|
$value =~ s/"/\\"/g; |
154
|
2
|
|
|
|
|
6
|
$result .= qq{ $prop="$value"}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
3
|
|
|
|
|
8
|
push @results, $result; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
3
|
100
|
|
|
|
9
|
push @results, 'none' unless @results; |
161
|
3
|
|
|
|
|
21
|
join '; ', $source, @results; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
#------------------------------------------ |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub addAttribute($;@) |
169
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
170
|
0
|
|
|
|
|
0
|
$self->log(ERROR => 'No attributes for Authentication-Results.'); |
171
|
0
|
|
|
|
|
0
|
$self; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
11
|
|
|
11
|
1
|
5316
|
sub server() { shift->{MMFA_server} } |
177
|
10
|
|
|
10
|
1
|
51
|
sub version() { shift->{MMFA_version} } |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
10
|
|
|
10
|
1
|
30
|
sub results() { @{shift->{MMFA_results}} } |
|
10
|
|
|
|
|
51
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub addResult($) |
184
|
11
|
|
|
11
|
1
|
22
|
{ my $self = shift; |
185
|
|
|
|
|
|
|
|
186
|
11
|
100
|
|
|
|
49
|
my $r = @_==1 ? shift : {@_}; |
187
|
11
|
50
|
33
|
|
|
56
|
$r->{method} && $r->{result} or return (); |
188
|
11
|
|
100
|
|
|
53
|
$r->{method_version} ||= 1; |
189
|
11
|
|
|
|
|
19
|
push @{$self->{MMFA_results}}, $r; |
|
11
|
|
|
|
|
30
|
|
190
|
11
|
|
|
|
|
37
|
delete $self->{MMFF_body}; |
191
|
|
|
|
|
|
|
|
192
|
11
|
|
|
|
|
25
|
$r; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
#------------------------------------------ |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
1; |