line |
true |
false |
branch |
68
|
22 |
22 |
if (my $sig = delete $args{'sign'}) |
71
|
22 |
0 |
if ref $sig ne 'ARRAY' |
75
|
22 |
0 |
if ref $_ |
77
|
0 |
22 |
unless $s |
91
|
19 |
85 |
if (ref $arg) { } |
99
|
44 |
41 |
if (defined $self->{'_hdrbuf'}) { } |
102
|
0 |
44 |
unless $self->{'_hdrbuf'} =~ /(\r?\n)\1/g |
108
|
22 |
22 |
if ($self->{'extract_sig'} and my(@sig) = _parse_header($self->{'header'})) |
110
|
0 |
22 |
if (my $f = $self->{'filter'}) |
113
|
22 |
0 |
if @sig |
116
|
44 |
0 |
if $arg ne '' |
123
|
0 |
85 |
if (not $self->{'sig'}) { } |
131
|
104 |
0 |
unless @_ |
134
|
0 |
104 |
unless $rv |
141
|
44 |
60 |
if $_->status |
145
|
41 |
19 |
unless $sig->{'bh:computed'} |
149
|
38 |
22 |
if ($sig->{'b'}) |
151
|
38 |
0 |
unless $self->{'records'}{$name} |
156
|
41 |
63 |
$need_more_data ? : |
163
|
0 |
0 |
if $self->{'header'} and $self->{'sig'} |
174
|
0 |
0 |
$ar ? : |
175
|
0 |
0 |
unless (shift())->result |
182
|
0 |
208 |
if defined $self->{'_hdrbuf'} |
183
|
0 |
208 |
unless $self->{'sig'} |
189
|
44 |
164 |
if ($sig->{':result'}) |
194
|
1 |
163 |
if ($sig->{'error'}) |
206
|
66 |
97 |
unless ($sig->{'b'}) |
208
|
44 |
22 |
if (not $sig->{'bh:computed'}) { } |
215
|
22 |
0 |
$dkim_sig ? : |
226
|
1 |
96 |
if ($sig->{'x'} and $sig->{'x'} < time) |
233
|
18 |
78 |
if ($txt and !ref($txt) || ref $txt eq 'ARRAY') { } |
|
1 |
154 |
elsif (exists $self->{'records'}{$dns} and not $txt) { } |
237
|
0 |
18 |
ref $txt ? : |
238
|
17 |
1 |
if (my $r = parse_dkimkey($_, \$error)) |
244
|
1 |
17 |
if $error |
252
|
20 |
76 |
if @v |
261
|
22 |
44 |
unless ref $v |
263
|
44 |
22 |
if ($for_signing) |
268
|
1 |
65 |
if (($v->{'v'} // '') ne '1') { } |
|
0 |
65 |
elsif (not $v->{'d'}) { } |
|
0 |
65 |
elsif (not $v->{'s'}) { } |
|
0 |
65 |
elsif (not $v->{'h'}) { } |
|
0 |
65 |
elsif ($v->{'l'} and not $v->{'l'} =~ /^\d{1,76}\z/) { } |
|
0 |
65 |
elsif (do {
$v->{'q'} = lc($v->{'q'} // 'dns/txt');
$v->{'q'} ne 'dns/txt'
}) { } |
284
|
1 |
65 |
if $$error |
292
|
0 |
65 |
unless grep {$_ eq 'from';} @h |
295
|
44 |
21 |
if ($for_signing) { } |
298
|
0 |
44 |
if exists $v->{'t'} |
299
|
0 |
44 |
if (defined $v->{'x'} and not $v->{'x'} =~ /^\+?\d{1,12}\z/) |
303
|
0 |
21 |
if (not $v->{'b'} && ($v->{'b:bin'} = _decode64($v->{'b'}))) { } |
|
0 |
21 |
elsif (not $v->{'bh'} && ($v->{'bh:bin'} = _decode64($v->{'bh'}))) { } |
|
0 |
21 |
elsif ($v->{'t'} and not $v->{'t'} =~ /^\d{1,12}\z/) { } |
|
1 |
20 |
elsif ($v->{'x'}) { } |
310
|
0 |
1 |
if (not $v->{'x'} =~ /^\d{1,12}\z/) { } |
|
0 |
2 |
elsif ($v->{'t'} and $v->{'x'} < $v->{'t'}) { } |
317
|
0 |
21 |
if ($v->{'i'}) { } |
319
|
0 |
0 |
if (lc($v->{'i'}) =~ /\@([^\@]+)$/) { } |
322
|
0 |
0 |
unless $v->{'i:domain'} =~ /^(.+\.)?\Q$v->{'d'}\E\z/ |
332
|
0 |
65 |
unless (my($hdrc, $bodyc) = $v->{'c'} =~ m[^(relaxed|simple)(?:/(relaxed|simple))?$]) |
336
|
0 |
65 |
unless (my($kalgo, $halgo) = $v->{'a'} =~ /^(rsa)-(sha(?:1|256))$/) |
339
|
0 |
65 |
if $$error |
354
|
18 |
0 |
unless ref $v |
355
|
1 |
17 |
unless ($v and %$v) |
360
|
0 |
17 |
if (($v->{'v'} ||= 'DKIM1') ne 'DKIM1') { } |
|
0 |
17 |
elsif (($v->{'k'} //= 'rsa') ne 'rsa') { } |
365
|
0 |
17 |
if (exists $v->{'g'}) |
378
|
0 |
0 |
unless ($v->{'s'}{'*'} or $v->{'s'}{'email'}) |
395
|
20 |
2 |
if (ref $sig and $sig->{'h_auto'}) |
406
|
20 |
120 |
if exists $oh{$k} and --$oh{$k} == 0 |
411
|
0 |
22 |
unless $sig = parse_signature($sig, $error, 1) |
415
|
0 |
22 |
if not $sig{'t'} and exists $sig{'t'} |
417
|
0 |
22 |
if $sig{'x'} and $sig{'x'} =~ /^\+(\d+)$/ |
418
|
0 |
22 |
unless ($sig{'a:key'} eq 'rsa') |
423
|
0 |
22 |
if $sig{':i'} |
424
|
0 |
22 |
if $sig{':z'} |
434
|
154 |
22 |
if /:/ |
443
|
114 |
86 |
@lines == 1 ? : |
444
|
159 |
41 |
if (length $append <= $x80) { } |
|
21 |
20 |
elsif (length $append <= 80) { } |
450
|
40 |
4 |
if ($x80 > 10) |
452
|
20 |
20 |
if $append eq '' |
461
|
0 |
22 |
unless ($sig->{'a:key'} eq 'rsa') |
468
|
0 |
22 |
ref $key ? : |
469
|
0 |
22 |
unless ($priv) |
480
|
66 |
11 |
if $x80 > 10 |
481
|
55 |
22 |
if $data ne '' |
495
|
1 |
95 |
if (defined $sig->{'bh:computed'} and $sig->{'bh:computed'} ne $sig->{'bh:bin'}) |
499
|
76 |
19 |
unless $param |
501
|
0 |
19 |
unless %$param |
502
|
1 |
18 |
if $param->{'tempfail'} |
503
|
1 |
17 |
if $param->{'permfail'} |
505
|
0 |
17 |
$param->{'t'}{'y'} ? : |
506
|
0 |
17 |
unless $param->{'p'} |
509
|
0 |
17 |
unless $param->{'h'}{$sig->{'a:hash'}} |
512
|
0 |
0 |
if $param->{'t'}{'s'} and $sig->{'i:domain'} and $sig->{'i:domain'} ne $sig->{'d'} |
515
|
0 |
17 |
if $param->{'g'} and not $sig->{'i'} =~ /$param->{'g'}/ |
518
|
0 |
17 |
unless defined $sig->{'bh:computed'} |
520
|
3 |
14 |
unless (eval {
do {
die [-3, 'using public key failed'] unless my $rsa = 'Crypt::OpenSSL::RSA'->new_public_key(do {
local $_ = $param->{'p'};
s/\s+//g;
s/(.{1,64})/$1\n/g;
"-----BEGIN PUBLIC KEY-----\n$_-----END PUBLIC KEY-----\n"
});
$rsa->use_no_padding;
die [-3, 'header sig corrupt'] unless my $bencrypt = eval {
do {
$rsa->encrypt($sig->{'b:bin'})
}
};
my $expect = _emsa_pkcs1_v15($sig->{'a:hash'}, $sig->{'h:hash'}, $rsa->size);
if ($expect ne $bencrypt) {
die [$FAIL, 'header sig mismatch'];
};
1
}
}) |
521
|
0 |
16 |
unless my $rsa = 'Crypt::OpenSSL::RSA'->new_public_key(do {
local $_ = $param->{'p'};
s/\s+//g;
s/(.{1,64})/$1\n/g;
"-----BEGIN PUBLIC KEY-----\n$_-----END PUBLIC KEY-----\n"
}) |
528
|
1 |
15 |
unless my $bencrypt = eval {
do {
$rsa->encrypt($sig->{'b:bin'})
}
} |
532
|
1 |
14 |
if ($expect ne $bencrypt) |
539
|
2 |
1 |
if ref $@ |
542
|
12 |
2 |
unless $sig->{':warning'} |
556
|
21 |
1 |
if ($sig) { } |
562
|
2 |
19 |
if (my(@h) = grep({$critical{$_} < 0;} keys %critical)) |
585
|
0 |
37 |
if $pad < 8 |
630
|
0 |
445 |
if ($k eq 'dkim-signature') { } |
632
|
0 |
0 |
if $_ eq $dkh |
723
|
0 |
85 |
if $sig->{'bh:computed'} |
725
|
43 |
1 |
if (not $sig->{'error'} and my $digest = $digest{$sig->{'a:hash'}}() and my $transform = $bodyc{$sig->{'c:body'}}()) { } |
733
|
1 |
41 |
defined $sig->{'l'} ? : |
|
1 |
42 |
$sig->{'l'} ? : |
741
|
1 |
84 |
if $bh->{'done'} |
742
|
41 |
43 |
if ($buf eq '') |
747
|
0 |
43 |
if $tbuf eq '' |
749
|
41 |
2 |
unless defined $bh->{'l'} |
750
|
1 |
1 |
if (ref $bh->{'l'}) |
754
|
1 |
0 |
if ($bh->{'l'} > 0) { } |
755
|
0 |
1 |
if ($bh->{'l'} -= length $tbuf) > 0 |
765
|
43 |
0 |
if $tbuf ne '' |
766
|
42 |
1 |
unless $bh->{'done'} |
772
|
1 |
41 |
if $bh->{'_data_after_l'} |
801
|
0 |
295 |
if (defined $3) |
805
|
40 |
255 |
unless defined $1 |
806
|
0 |
255 |
if (exists $v{$1}) |
823
|
44 |
0 |
if $pad |
860
|
0 |
8 |
$_[0][2] > 0 ? : |
861
|
16 |
0 |
$_[0][2] > 0 ? : |
865
|
0 |
0 |
unless $self->[2] |
867
|
0 |
0 |
if defined $self->[3] and $self->[3] ne '' |