line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::DMARC::Report; |
2
|
9
|
|
|
9
|
|
717
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
337
|
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
449
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.20211209'; |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
55
|
use Carp; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
641
|
|
8
|
9
|
|
|
9
|
|
5906
|
use IO::Compress::Gzip; |
|
9
|
|
|
|
|
263115
|
|
|
9
|
|
|
|
|
652
|
|
9
|
9
|
|
|
9
|
|
7790
|
use IO::Compress::Zip; |
|
9
|
|
|
|
|
134125
|
|
|
9
|
|
|
|
|
577
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
104
|
use parent 'Mail::DMARC::Base'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
140
|
|
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
|
51
|
my ( $self, $xml_ref ) = @_; |
21
|
5
|
50
|
|
|
|
28
|
croak "xml is not a reference!" if 'SCALAR' ne ref $xml_ref; |
22
|
5
|
|
|
|
|
8
|
my $shrunk; |
23
|
5
|
|
|
|
|
35
|
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
|
|
|
|
|
12
|
my $cf = 'gz'; |
30
|
5
|
50
|
|
|
|
39
|
$zipper->{$cf}->( $xml_ref, \$shrunk ) or croak "unable to compress: $!"; |
31
|
5
|
|
|
|
|
13440
|
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
|
6878
|
my $self = shift; |
43
|
42
|
100
|
|
|
|
274
|
return $self->{aggregate} if ref $self->{aggregate}; |
44
|
10
|
|
|
|
|
101
|
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
|
3
|
my $self = shift; |
54
|
1
|
50
|
|
|
|
5
|
return $self->{receive} if ref $self->{receive}; |
55
|
1
|
|
|
|
|
11
|
return $self->{receive} = Mail::DMARC::Report::Receive->new; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub sendit { |
59
|
5
|
|
|
5
|
0
|
464
|
my $self = shift; |
60
|
5
|
50
|
|
|
|
22
|
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
|
52
|
my $self = shift; |
66
|
21
|
100
|
|
|
|
173
|
return $self->{store} if ref $self->{store}; |
67
|
12
|
|
|
|
|
144
|
return $self->{store} = Mail::DMARC::Report::Store->new(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub uri { |
71
|
27
|
|
|
27
|
0
|
51
|
my $self = shift; |
72
|
27
|
100
|
|
|
|
142
|
return $self->{uri} if ref $self->{uri}; |
73
|
10
|
|
|
|
|
101
|
return $self->{uri} = Mail::DMARC::Report::URI->new(); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub save_aggregate { |
77
|
5
|
|
|
5
|
0
|
11
|
my $self = shift; |
78
|
5
|
|
|
|
|
27
|
return $self->store->backend->save_aggregate( $self->aggregate ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |