line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 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.03. |
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
|
22
|
|
|
22
|
|
852
|
use vars '$VERSION'; |
|
22
|
|
|
|
|
60
|
|
|
22
|
|
|
|
|
1278
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
12
|
|
|
|
|
|
|
|
13
|
22
|
|
|
22
|
|
151
|
use base 'Mail::Message::Field::Structured'; |
|
22
|
|
|
|
|
53
|
|
|
22
|
|
|
|
|
2686
|
|
14
|
|
|
|
|
|
|
|
15
|
22
|
|
|
22
|
|
184
|
use warnings; |
|
22
|
|
|
|
|
60
|
|
|
22
|
|
|
|
|
584
|
|
16
|
22
|
|
|
22
|
|
142
|
use strict; |
|
22
|
|
|
|
|
54
|
|
|
22
|
|
|
|
|
702
|
|
17
|
|
|
|
|
|
|
|
18
|
22
|
|
|
22
|
|
11798
|
use URI; |
|
22
|
|
|
|
|
100089
|
|
|
22
|
|
|
|
|
45117
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init($) |
23
|
9
|
|
|
9
|
0
|
21
|
{ my ($self, $args) = @_; |
24
|
9
|
|
|
|
|
78
|
$self->{MMFA_server} = delete $args->{server}; |
25
|
9
|
|
|
|
|
22
|
$self->{MMFA_version} = delete $args->{version}; |
26
|
|
|
|
|
|
|
|
27
|
9
|
|
|
|
|
21
|
$self->{MMFA_results} = []; |
28
|
9
|
50
|
|
|
|
14
|
$self->addResult($_) for @{delete $args->{results} || []}; |
|
9
|
|
|
|
|
48
|
|
29
|
|
|
|
|
|
|
|
30
|
9
|
|
|
|
|
38
|
$self->SUPER::init($args); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub parse($) |
34
|
8
|
|
|
8
|
1
|
17
|
{ my ($self, $string) = @_; |
35
|
8
|
|
|
|
|
62
|
$string =~ s/\r?\n/ /g; |
36
|
|
|
|
|
|
|
|
37
|
8
|
|
|
|
|
29
|
(undef, $string) = $self->consumeComment($string); |
38
|
8
|
100
|
|
|
|
54
|
$self->{MMFA_server} = $string =~ s/^\s*([.\w-]*\w)// ? $1 : 'unknown'; |
39
|
|
|
|
|
|
|
|
40
|
8
|
|
|
|
|
25
|
(undef, $string) = $self->consumeComment($string); |
41
|
8
|
100
|
|
|
|
36
|
$self->{MMFA_version} = $string =~ s/^\s*([0-9]+)// ? $1 : 1; |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
|
|
|
21
|
(undef, $string) = $self->consumeComment($string); |
44
|
8
|
|
|
|
|
32
|
$string =~ s/^.*?\;/;/; # remove accidents |
45
|
|
|
|
|
|
|
|
46
|
8
|
|
|
|
|
16
|
my @results; |
47
|
8
|
|
|
|
|
31
|
while( $string =~ s/^\s*\;// ) |
48
|
|
|
|
|
|
|
{ |
49
|
12
|
|
|
|
|
35
|
(undef, $string) = $self->consumeComment($string); |
50
|
12
|
100
|
|
|
|
42
|
if($string =~ s/^\s*none//) |
51
|
3
|
|
|
|
|
10
|
{ (undef, $string) = $self->consumeComment($string); |
52
|
3
|
|
|
|
|
10
|
next; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
9
|
|
|
|
|
15
|
my %result; |
56
|
9
|
|
|
|
|
19
|
push @results, \%result; |
57
|
|
|
|
|
|
|
|
58
|
9
|
50
|
|
|
|
39
|
$string =~ s/^\s*([\w-]*\w)// or next; |
59
|
9
|
|
|
|
|
26
|
$result{method} = $1; |
60
|
|
|
|
|
|
|
|
61
|
9
|
|
|
|
|
27
|
(undef, $string) = $self->consumeComment($string); |
62
|
9
|
100
|
|
|
|
32
|
if($string =~ s!^\s*/!!) |
63
|
1
|
|
|
|
|
4
|
{ (undef, $string) = $self->consumeComment($string); |
64
|
1
|
50
|
|
|
|
7
|
$result{method_version} = $1 if $string =~ s/^\s*([0-9]+)//; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
9
|
|
|
|
|
20
|
(undef, $string) = $self->consumeComment($string); |
68
|
9
|
50
|
|
|
|
40
|
if($string =~ s/^\s*\=//) |
69
|
9
|
|
|
|
|
23
|
{ (undef, $string) = $self->consumeComment($string); |
70
|
9
|
50
|
|
|
|
50
|
$result{result} = $1 |
71
|
|
|
|
|
|
|
if $string =~ s/^\s*(\w+)//; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
9
|
|
|
|
|
26
|
(my $comment, $string) = $self->consumeComment($string); |
75
|
9
|
100
|
|
|
|
24
|
if($comment) |
76
|
3
|
|
|
|
|
8
|
{ $result{comment} = $comment; |
77
|
3
|
|
|
|
|
8
|
(undef, $string) = $self->consumeComment($string); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
9
|
100
|
|
|
|
29
|
if($string =~ s/\s*reason//) |
81
|
2
|
|
|
|
|
7
|
{ (undef, $string) = $self->consumeComment($string); |
82
|
2
|
50
|
|
|
|
10
|
if($string =~ s/\s*\=//) |
83
|
2
|
|
|
|
|
6
|
{ (undef, $string) = $self->consumeComment($string); |
84
|
2
|
0
|
33
|
|
|
17
|
$result{reason} = $1 |
|
|
|
33
|
|
|
|
|
85
|
|
|
|
|
|
|
if $string =~ s/^\"([^"]*)\"// |
86
|
|
|
|
|
|
|
|| $string =~ s/^\'([^']*)\'// |
87
|
|
|
|
|
|
|
|| $string =~ s/^(\w+)//; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
9
|
|
|
|
|
34
|
while($string =~ /\S/) |
92
|
13
|
|
|
|
|
49
|
{ (undef, $string) = $self->consumeComment($string); |
93
|
13
|
100
|
|
|
|
57
|
last if $string =~ /^\s*\;/; |
94
|
|
|
|
|
|
|
|
95
|
9
|
100
|
|
|
|
45
|
my $ptype = $string =~ s/^\s*([\w-]+)// ? $1 : last; |
96
|
8
|
|
|
|
|
23
|
(undef, $string) = $self->consumeComment($string); |
97
|
|
|
|
|
|
|
|
98
|
8
|
|
|
|
|
16
|
my ($property, $value); |
99
|
8
|
50
|
|
|
|
39
|
if($string =~ s/^\s*\.//) |
100
|
8
|
|
|
|
|
22
|
{ (undef, $string) = $self->consumeComment($string); |
101
|
8
|
50
|
|
|
|
42
|
$property = $string =~ s/^\s*([\w-]+)// ? $1 : last; |
102
|
8
|
|
|
|
|
23
|
(undef, $string) = $self->consumeComment($string); |
103
|
8
|
50
|
|
|
|
37
|
if($string =~ s/^\s*\=//) |
104
|
8
|
|
|
|
|
19
|
{ (undef, $string) = $self->consumeComment($string); |
105
|
8
|
|
|
|
|
22
|
$string =~ s/^\s+//; |
106
|
8
|
50
|
33
|
|
|
69
|
$string =~ s/^\"([^"]*)\"// |
|
|
|
33
|
|
|
|
|
107
|
|
|
|
|
|
|
|| $string =~ s/^\'([^']*)\'// |
108
|
|
|
|
|
|
|
|| $string =~ s/^([\w@.-]+)// |
109
|
|
|
|
|
|
|
or last; |
110
|
|
|
|
|
|
|
|
111
|
8
|
|
|
|
|
20
|
$value = $1; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
8
|
50
|
|
|
|
23
|
if(defined $value) |
116
|
8
|
|
|
|
|
40
|
{ $result{"$ptype.$property"} = $value; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
else |
119
|
0
|
|
|
|
|
0
|
{ $string =~ s/^.*?\;/;/g; # recover from parser problem |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
8
|
|
|
|
|
24
|
$self->addResult($_) for @results; |
124
|
|
|
|
|
|
|
|
125
|
8
|
|
|
|
|
18
|
$self; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub produceBody() |
129
|
3
|
|
|
3
|
1
|
7
|
{ my $self = shift; |
130
|
3
|
|
|
|
|
10
|
my $source = $self->server; |
131
|
3
|
|
|
|
|
8
|
my $version = $self->version; |
132
|
3
|
50
|
|
|
|
9
|
$source .= " $version" if $version!=1; |
133
|
|
|
|
|
|
|
|
134
|
3
|
|
|
|
|
7
|
my @results; |
135
|
3
|
|
|
|
|
6
|
foreach my $r ($self->results) |
136
|
3
|
|
|
|
|
6
|
{ my $method = $r->{method}; |
137
|
|
|
|
|
|
|
$method .= "/$r->{method_version}" |
138
|
3
|
100
|
|
|
|
14
|
if $r->{method_version} != 1; |
139
|
|
|
|
|
|
|
|
140
|
3
|
|
|
|
|
10
|
my $result = "$method=$r->{result}"; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$result .= ' ' . $self->createComment($r->{comment}) |
143
|
3
|
100
|
|
|
|
16
|
if defined $r->{comment}; |
144
|
|
|
|
|
|
|
|
145
|
3
|
50
|
|
|
|
12
|
if(my $reason = $r->{reason}) |
146
|
0
|
|
|
|
|
0
|
{ $reason =~ s/"/\\"/g; |
147
|
0
|
|
|
|
|
0
|
$result .= qq{ reason="$reason"}; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
3
|
|
|
|
|
16
|
foreach my $prop (sort keys %$r) |
151
|
12
|
100
|
|
|
|
30
|
{ index($prop, '.') > -1 or next; |
152
|
2
|
|
|
|
|
4
|
my $value = $r->{$prop}; |
153
|
2
|
|
|
|
|
4
|
$value =~ s/"/\\"/g; |
154
|
2
|
|
|
|
|
10
|
$result .= qq{ $prop="$value"}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
3
|
|
|
|
|
12
|
push @results, $result; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
3
|
100
|
|
|
|
11
|
push @results, 'none' unless @results; |
161
|
3
|
|
|
|
|
20
|
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
|
3470
|
sub server() { shift->{MMFA_server} } |
177
|
10
|
|
|
10
|
1
|
45
|
sub version() { shift->{MMFA_version} } |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
10
|
|
|
10
|
1
|
20
|
sub results() { @{shift->{MMFA_results}} } |
|
10
|
|
|
|
|
41
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub addResult($) |
184
|
11
|
|
|
11
|
1
|
19
|
{ my $self = shift; |
185
|
|
|
|
|
|
|
|
186
|
11
|
100
|
|
|
|
38
|
my $r = @_==1 ? shift : {@_}; |
187
|
11
|
50
|
33
|
|
|
45
|
$r->{method} && $r->{result} or return (); |
188
|
11
|
|
100
|
|
|
56
|
$r->{method_version} ||= 1; |
189
|
11
|
|
|
|
|
15
|
push @{$self->{MMFA_results}}, $r; |
|
11
|
|
|
|
|
26
|
|
190
|
11
|
|
|
|
|
21
|
delete $self->{MMFF_body}; |
191
|
|
|
|
|
|
|
|
192
|
11
|
|
|
|
|
21
|
$r; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
#------------------------------------------ |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
1; |