Branch Coverage

blib/lib/Mail/SpamAssassin/DnsResolver.pm
Criterion Covered Total %
branch 108 278 38.8


line true false branch
58 41 0 if (eval {
0 0 elsif (eval {
0 0 elsif (eval {
97 0 92 if ($self->{'res'})
104 0 92 if (not $force_ipv4 and $io_socket_module_name eq "IO::Socket::INET")
106 0 0 if $force_ipv6
109 92 0 unless ($force_ipv4)
112 92 0 if ($io_socket_module_name)
115 0 0 unless $sock6->close
0 92 if ($sock6)
117 92 0 unless (eval {
120 0 92 if $force_ipv6
131 92 0 if ($res)
150 92 0 if ($edns and $edns > 512)
160 182 0 /^\[(.*)\]:(\d+)\z/ ? :
165 0 92 unless (eval {
166 0 0 $@ ne '' ? :
174 0 0 $self->{'force_ipv6'} ? :
92 0 $self->{'force_ipv4'} ? :
176 0 92 $self->{'no_resolver'} ? :
177 92 0 if (not $self->{'no_resolver'} and defined $Net::DNS::VERSION)
207 1 90 if ($self->{'conf'}{'dns_servers'}) { }
90 0 elsif ($res) { }
212 90 0 $res->UNIVERSAL::can('nameservers') ? :
213 0 90 $res->UNIVERSAL::can('port') ? :
230 0 115 if (@_) { }
91 24 elsif (not $self->{'available_dns_servers'}) { }
238 115 0 if ($self->{'force_ipv4'} or $self->{'force_ipv6'})
244 0 205 unless /^ \[ (.*) \] : (\d+) \z/sx
246 205 0 if ($addr =~ /^$ip4_re\z/o) { }
0 0 elsif ($addr =~ /:.*:/) { }
247 205 0 unless $self->{'force_ipv6'}
249 0 0 unless $self->{'force_ipv4'}
254 0 115 if (@filtered_addr_port < @{$self->{'available_dns_servers'};})
261 0 115 unless @{$self->{'available_dns_servers'};}
267 0 0 if ($lport >= 0 and $lport <= 65535)
269 0 0 unless (defined $conf->{'dns_available_portscount'})
272 0 0 if (vec $conf->{'dns_available_ports_bitset'}, $lport, 1)
289 1 1 unless (defined $available_portscount)
291 1 0 unless (defined $ports_bitset)
306 4 252 if ($b eq $all_zeroes) { }
252 0 elsif ($b eq $all_ones) { }
315 1 0 if ($available_portscount) { }
325 2 0 if ($available_portscount > 0)
333 2 293 if ($cnt > $n) { }
337 457 0 if (vec $ports_bitset, $ind, 1)
338 2 455 if ($n <= 0) { }
356 0 2 $self->{'no_resolver'} ? :
357 0 2 if $self->{'no_resolver'}
359 0 2 unless $io_socket_module_name
362 0 2 if ($self->{'sock'})
364 0 0 unless $self->{'sock'}->close
374 2 0 if $ns_addr_port[0] =~ /^\[(.*)\]:(\d+)\z/
383 2 0 if ($self->{'force_ipv4'}) { }
0 0 elsif ($self->{'force_ipv6'}) { }
0 0 elsif ($ns_addr =~ /^$ip4_re\z/o) { }
0 0 elsif ($ns_addr =~ /:.*:/) { }
401 0 2 unless (defined $lport)
405 0 2 if ($attempts + 1 > 50)
422 2 0 if $sock
425 0 0 $io_socket_module_name eq 'IO::Socket::IP' ? :
427 0 0 if ($! == 98 or $! == 13) { }
430 0 0 if ($self->{'conf'}{'dns_available_portscount'} > 100)
438 0 2 unless ($sock)
445 0 2 unless $bufsiz = $sock->sockopt(8)
447 2 0 if ($bufsiz >= 32768) { }
451 0 0 unless $sock->sockopt(8, 32768)
453 0 0 unless $newbufsiz = $sock->sockopt(8)
459 0 2 unless (eval {
460 0 0 $@ ne '' ? :
475 2 19 if not $self->{'sock'}
515 0 0 if (chr($ic) =~ /^[A-Za-z]\z/)
516 0 0 if ($have_rnd_bits < 1)
520 0 0 if $rnd & 1
533 0 21 if $self->{'no_resolver'}
536 0 21 if (not defined $type or $type eq "PTR")
538 0 0 if ($domain =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)
543 0 21 unless defined $type
544 21 0 unless defined $class
549 0 21 if (utf8::is_utf8($domain))
554 0 21 if (length $domain > 255) { }
0 21 elsif (not $domain =~ /^ (?: [^.]{1,63} \. )+ \z/sx) { }
557 0 0 if (not $domain =~ /^ (?: [^.]+ \. )+ \z/sx) { }
564 0 21 if ($self->{'conf'}{'dns_options'}{'dns0x20'}) { }
574 0 0 $1 eq '\\' ? :
582 0 21 unless (eval {
585 0 0 $@ ne '' ? :
587 0 0 if $eval_stat =~ /__alarm__ignore__\(.*\)/s
592 21 0 if ($packet)
598 21 0 if ($udp_payload_size and $udp_payload_size > 512)
600 21 0 if ($packet->UNIVERSAL::can('edns')) { }
624 0 42 unless @questions <= 1
627 42 0 if ($questions[0]) { }
639 42 0 unless $self->{'conf'}{'dns_options'}{'dns0x20'}
685 0 21 if $self->{'no_resolver'}
690 0 21 unless $pkt
701 21 0 if ($self->{'sock'} and defined $self->{'sock'}->send($pkt->data, 0)) { }
704 0 0 !$self->{'sock'} ? :
707 0 0 if ($attempts >= $n_servers)
717 0 21 unless $ok
738 0 21 if $packetsize < 512
741 0 21 unless defined $peeraddr
743 0 21 unless $data ne ""
746 0 21 unless $answerpkt
748 0 21 if (defined $decoded_length and $decoded_length ne "" and $decoded_length != length $data)
766 0 11 if $self->{'no_resolver'}
767 0 11 unless $self->{'sock'}
777 8 24 if (not defined $timeout or $timeout > 0)
782 0 32 unless (eval {
783 0 0 $@ ne '' ? :
785 0 32 if (defined $eval_stat) { }
0 32 elsif (not defined $nfound or $nfound < 0) { }
11 21 elsif (not $nfound) { }
787 0 0 if $eval_stat =~ /__alarm__ignore__\(.*\)/s
791 0 0 if ($!) { }
795 0 11 if (not defined $timeout) { }
0 11 elsif ($timeout > 0) { }
802 0 21 if $nfound == 0
809 0 21 unless (eval {
811 0 0 $@ ne '' ? :
813 0 0 if $eval_stat =~ /__alarm__ignore__\(.*\)/s
817 0 21 if (not $packet) { }
824 0 21 if (not $header) { }
831 10 11 if ($rcode eq 'NOERROR') { }
835 0 10 if ($header->tc)
837 0 0 $edns == 512 ? :
853 21 0 if ($cb) { }
857 0 0 if ($rcode eq 'REFUSED' or $id =~ m[^\d+/NO_QUESTION_IN_PACKET\z]) { }
862 0 0 $packet ? :
866 0 0 if ($id =~ m[^(\d+)/])
870 0 0 if (not @matches) { }
915 0 8 if $self->{'no_resolver'}
934 0 8 if $timeout < 1
941 0 8 unless defined $id
947 0 8 if ($now >= $deadline)
971 0 0 if $self->{'send_timed_out'}
985 2 51 if ($self->{'sock'})
987 0 2 unless $self->{'sock'}->close
1015 0 2 if (not defined $fno) { }