line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DMARC::Report; |
2
|
9
|
|
|
9
|
|
582
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
312
|
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
420
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.20210927'; |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
65
|
use Carp; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
592
|
|
8
|
9
|
|
|
9
|
|
4240
|
use IO::Compress::Gzip; |
|
9
|
|
|
|
|
244822
|
|
|
9
|
|
|
|
|
586
|
|
9
|
9
|
|
|
9
|
|
5618
|
use IO::Compress::Zip; |
|
9
|
|
|
|
|
123194
|
|
|
9
|
|
|
|
|
559
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
90
|
use parent 'Mail::DMARC::Base'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
132
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Mail::DMARC::Report::Aggregate; |
14
|
|
|
|
|
|
|
require Mail::DMARC::Report::Send; |
15
|
|
|
|
|
|
|
require Mail::DMARC::Report::Store; |
16
|
|
|
|
|
|
|
require Mail::DMARC::Report::Receive; |
17
|
|
|
|
|
|
|
require Mail::DMARC::Report::URI; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub compress { |
20
|
5
|
|
|
5
|
0
|
57
|
my ( $self, $xml_ref ) = @_; |
21
|
5
|
50
|
|
|
|
27
|
croak "xml is not a reference!" if 'SCALAR' ne ref $xml_ref; |
22
|
5
|
|
|
|
|
11
|
my $shrunk; |
23
|
5
|
|
|
|
|
45
|
my $zipper = { |
24
|
|
|
|
|
|
|
gz => \&IO::Compress::Gzip::gzip, # 2013 draft |
25
|
|
|
|
|
|
|
zip => \&IO::Compress::Zip::zip, # legacy format |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
# WARNING: changes here MAY require updates in SMTP::assemble_message |
28
|
|
|
|
|
|
|
# my $cf = ( time > 1372662000 ) ? 'gz' : 'zip'; # gz after 7/1/13 |
29
|
5
|
|
|
|
|
11
|
my $cf = 'gz'; |
30
|
5
|
50
|
|
|
|
39
|
$zipper->{$cf}->( $xml_ref, \$shrunk ) or croak "unable to compress: $!"; |
31
|
5
|
|
|
|
|
12842
|
return $shrunk; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub init { |
35
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
36
|
0
|
|
|
|
|
0
|
delete $self->{dmarc}; |
37
|
0
|
|
|
|
|
0
|
delete $self->{aggregate}; |
38
|
0
|
|
|
|
|
0
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub aggregate { |
42
|
42
|
|
|
42
|
0
|
8330
|
my $self = shift; |
43
|
42
|
100
|
|
|
|
243
|
return $self->{aggregate} if ref $self->{aggregate}; |
44
|
10
|
|
|
|
|
78
|
return $self->{aggregate} = Mail::DMARC::Report::Aggregate->new(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub dmarc { |
48
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
49
|
0
|
|
|
|
|
0
|
return $self->{dmarc}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub receive { |
53
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
54
|
1
|
50
|
|
|
|
5
|
return $self->{receive} if ref $self->{receive}; |
55
|
1
|
|
|
|
|
12
|
return $self->{receive} = Mail::DMARC::Report::Receive->new; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub sendit { |
59
|
5
|
|
|
5
|
0
|
569
|
my $self = shift; |
60
|
5
|
50
|
|
|
|
26
|
return $self->{sendit} if ref $self->{sendit}; |
61
|
5
|
|
|
|
|
51
|
return $self->{sendit} = Mail::DMARC::Report::Send->new(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub store { |
65
|
21
|
|
|
21
|
0
|
49
|
my $self = shift; |
66
|
21
|
100
|
|
|
|
126
|
return $self->{store} if ref $self->{store}; |
67
|
12
|
|
|
|
|
114
|
return $self->{store} = Mail::DMARC::Report::Store->new(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub uri { |
71
|
27
|
|
|
27
|
0
|
56
|
my $self = shift; |
72
|
27
|
100
|
|
|
|
168
|
return $self->{uri} if ref $self->{uri}; |
73
|
10
|
|
|
|
|
96
|
return $self->{uri} = Mail::DMARC::Report::URI->new(); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub save_aggregate { |
77
|
5
|
|
|
5
|
0
|
11
|
my $self = shift; |
78
|
5
|
|
|
|
|
19
|
return $self->store->backend->save_aggregate( $self->aggregate ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |