Branch Coverage

blib/lib/Net/DNSBL/MultiDaemon.pm
Criterion Covered Total %
branch 150 318 47.1


line true false branch
541 0 1734 unless $_ =~ /\./
542 0 1734 unless exists $CNTs{"$_"}
555 0 1 if (exists $CNTs{"$blist_0"}) { }
561 1 0 unless $newstat
566 4 194 if (exists $AVGs{"$b"} and exists $AVGs{"$a"}) { }
2 192 elsif (exists $AVGs{"$b"}) { }
2 190 elsif (exists $AVGs{"$a"}) { }
629 323 16 if ($prp == 0) { }
12 4 elsif ($prp > 0) { }
632 322 1 if (exists $cache{$k1}) { }
635 1 321 if ($cache{$k1}{'expires'} < $now) { }
320 1 elsif (exists $cache{$k2}) { }
642 5 315 if ($cache{$k2}{'expires'} < $now) { }
140 175 elsif ($cache{$k1}{'used'} > $cache{$k2}{'used'} or $cache{$k1}{'used'} == $cache{$k2}{'used'} and $cache{$k1}{'expires'} > $cache{$k2}{'expires'}) { }
654 8 132 if $pai < 0
673 319 4 if $pai < $pnd
677 2 2 if ($pnd > 0) { }
686 12 0 if exists $cache{$k}
688 2 10 unless ($pai < $pnd)
693 0 4 unless $csize
696 0 4 unless $pnd
723 23 0 if ($notRHBL or not $ubl)
724 0 23 wantarray ? :
726 0 0 unless $rid
727 0 0 unless exists $$rtp{$rid}
731 0 0 unless ($white)
737 0 0 wantarray ? :
747 0 43 if ($myip and $myip ne '0.0.0.0') { }
752 0 43 unless $DEBUG
753 24 19 $DEBUG & $Net::DNSBL::MultiDaemon::D_CLRRUN ? :
768 0 43 if ($$DNSBL{'MDsyslog'})
776 2 0 if ($$DNSBL{'IGNORE'} and ref $$DNSBL{'IGNORE'} eq 'ARRAY' and @{$$DNSBL{'IGNORE'};})
781 1 0 if ($$DNSBL{'BLOCK'} and ref $$DNSBL{'BLOCK'} eq 'ARRAY' and @{$$DNSBL{'BLOCK'};})
786 0 43 if ($$DNSBL{'BBC'} and ref $$DNSBL{'BBC'} eq 'ARRAY' and @{$$DNSBL{'BBC'};} and eval { do { require Geo::IP::PurePerl } }) { }
793 0 43 if (exists $$DNSBL{'MDcache'})
795 0 0 if $$DNSBL{'MDcache'} < 10000
799 0 43 if ($$DNSBL{'RHBL'}) { }
801 0 0 if (ref $$DNSBL{'RHBL'} and exists $$DNSBL{'RHBL'}{'urbltlds'} && ref $$DNSBL{'RHBL'}{'urbltlds'} eq 'ARRAY' || exists $$DNSBL{'RHBL'}{'urblwhite'} && ref $$DNSBL{'RHBL'}{'urblwhite'} eq 'ARRAY' || exists $$DNSBL{'RHBL'}{'urblblack'} && ref $$DNSBL{'RHBL'}{'urblblack'} eq 'ARRAY' and eval { do { no warnings; require URBL::Prepare } })
811 0 0 if (exists $$DNSBL{'RHBL'}{'urlwhite'} and ref $$DNSBL{'RHBL'}{'urlwhite'} eq 'ARRAY')
814 0 0 if (exists $$DNSBL{'RHBL'}{'urltld3'} and ref $$DNSBL{'RHBL'}{'urltld3'} eq 'ARRAY')
817 0 0 if (exists $$DNSBL{'RHBL'}{'urltld2'} and ref $$DNSBL{'RHBL'}{'urltld2'} eq 'ARRAY')
835 0 43 if (exists $$DNSBL{'GENERIC'} and ref $$DNSBL{'GENERIC'} eq 'HASH' and $regexptr = $$DNSBL{'GENERIC'}{'regexp'} and ref $regexptr eq 'ARRAY' and @$regexptr > 0) { }
841 0 0 unless ($$DNSBL{'GENERIC'}{'ignore'} and 'ARRAY' eq ref($iptr = $$DNSBL{'GENERIC'}{'ignore'}) and @$iptr > 0)
861 0 0 unless $Sfile
869 0 0 if $LogLevel
894 129 87 unless $_ =~ /\./
901 25 45 if %remoteThreads
904 60 10 if ($nfound > 0) { }
907 0 45 unless $l_Sin = recv($L, $msg, PACKETSZ(), 0)
908 3 42 if (length $msg < HFIXEDSZ())
909 3 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_SHRTHD
915 1 41 if ($qr)
916 1 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_QRESP
923 0 41 if ($eXT and exists $$eXT{'OPCODE'} and $$eXT{'OPCODE'}($eXT, $get, $put, \$msg, $off, $id, $qr, $opcode, $aa, $tc, $rd, $ra, $mbz, $ad, $cd, $rcode, $qdcount, $ancount, $nscount, $arcount)) { }
1 40 elsif ($opcode != QUERY()) { }
4 36 elsif ($qdcount != 1 or $ancount or $nscount or $arcount) { }
1 35 elsif (($off, $name, $type, $class) = $get->Question(\$msg, $off) and not $name) { }
1 34 elsif (not $eXT && exists $$eXT{'CLASS'} && $$eXT{'CLASS'}($eXT, $get, $put, $id, $opcode, \$name, \$type, \$class) and $class != C_IN()) { }
1 33 elsif ($eXT and exists $$eXT{'NAME'} and $$eXT{'NAME'}($eXT, $get, $put, $id, $opcode, \$name, \$type, \$class) or not $name =~ /$BLzone$/i) { }
956 0 33 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
959 0 33 if ($eXT and exists $$eXT{'TYPE'} and my $rv = $$eXT{'TYPE'}($eXT, $get, $put, $id, $opcode, \$name, \$type, \$class)) { }
27 6 elsif ($type == T_A() or $type == T_ANY() or $type == T_TXT()) { }
0 6 elsif ($type == T_NS() and $BLzone eq lc $name) { }
4 2 elsif ($type == T_NS() or $type == T_MX() or $type == T_SOA() or $type == T_CNAME() or $type == T_TXT()) { }
1 1 elsif ($type == T_AXFR()) { }
965 25 2 if ($notRHBL and $name =~ /^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}))\.(.+)/ and $rip = $1 and $targetIP = "$5.$4.$3.$2" and $zone = $6 and $BLzone eq lc $zone or not $notRHBL and $name =~ /^([a-zA-Z0-9][a-zA-Z0-9\.\-]+[a-zA-Z0-9])\.$BLzone$/ and $rip = $1 and $targetIP = 1 and $zone = $BLzone) { }
0 2 elsif ($BLzone eq lc $name and $type != T_TXT()) { }
980 0 25 if ($eXT and exists $$eXT{'CACHE'} and my $rv = $$eXT{'CACHE'}($eXT, $get, $put, $id, $opcode, $rip, \$name, \$type, \$class, $ubl)) { }
0 25 elsif (not $notRHBL and $ubl and do { if ($ubl->urblwhite($rip)) { not_found($put, $name, $type, $id, \$msg, $SOAptr); $rv = 'whitelisted'; } elsif ($ubl->urblblack($rip)) { ($msg) = _ansrbak($put, $id, 1, $rip, $zone, $type, 3600, A1272(), $BLzone, $myip, 'blacklisted'); $rv = 'blacklisted'; } }) { }
0 25 elsif ($rip eq '2.0.0.127') { }
0 25 elsif ($csize and exists $cache{$rip} and ($expires = $cache{$rip}{'expires'}) > $now) { }
0 25 elsif ($type == T_TXT()) { }
1 24 elsif ($notRHBL and @NAignore and matchNetAddr($targetIP, \@NAignore)) { }
1 23 elsif ($notRHBL and @NAblock and matchNetAddr($targetIP, \@NAblock)) { }
0 23 elsif ($notRHBL and $BBC and $cc = $BBC->country_code_by_addr($targetIP) and grep(($cc eq $_), @{$$DNSBL{'BBC'};})) { }
986 0 0 if ($ubl->urblwhite($rip)) { }
0 0 elsif ($ubl->urblblack($rip)) { }
1009 0 0 $txt ? :
1033 0 0 unless $newstat
1040 69 47 unless $_ =~ /\./
1043 0 23 if $regexptr
1046 0 23 if ($eXT and exists $$eXT{'LOOKUP'})
1053 0 23 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1100 0 18 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1107 0 15 unless recv $R, $msg, PACKETSZ(), 0
1108 5 10 if (length $msg < HFIXEDSZ())
1109 5 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_SHRTHD
1116 4 6 unless ($tc == 0 and $qr == 1 and $opcode == QUERY() and $rcode == NOERROR() || $rcode == NXDOMAIN() || $rcode == SERVFAIL() and $qdcount == 1 and exists $remoteThreads{$rid})
1122 4 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_NOTME
1126 0 6 exists $remoteThreads{$rid}{'urbl'} ? :
1129 6 0 if ($ancount and $rcode == &NOERROR) { }
0 0 elsif ($t == T_PTR() and $rcode == NXDOMAIN() || $rcode == SERVFAIL()) { }
1130 0 6 unless $name =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\.(.+)$/
1133 0 6 $z eq lc $blist[0] || $z eq 'in-addr.arpa' && $blist[0] eq 'genericPTR' ? :
1135 0 0 unless ($z and !$urbldom && $rip eq $1 || $urbldom && $urbldom eq $1 and $t == T_A() || $t == T_PTR() and $class == C_IN())
1140 6 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_NOTME
1151 0 0 if $answer
1152 0 0 if ($t == T_A()) { }
0 0 elsif ($t == T_PTR() and $blist[0] eq 'genericPTR') { }
1153 0 0 if (exists $$DNSBL{"$blist[0]"}{'acceptany'})
1158 0 0 exists $$DNSBL{"$blist[0]"}{'acceptmask'} ? :
1162 0 0 if ($mask & unpack('N', $answer) or grep(($IP eq $_), keys %{$$DNSBL{"$blist[0]"}{'accept'};}))
1184 0 0 if (@generic)
1187 0 0 if $iptr and grep(($g =~ /$_/i), @$iptr)
1188 0 0 if $g and not grep(($g =~ /$_/i), @$regexptr)
1190 0 0 unless @names
1193 0 0 if ($answer) { }
0 0 elsif (do { print STDERR '+' if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE; my $rv = 0; until ($rv) { shift @blist; if (not @blist) { $rv = 1; } else { last unless $deadDNSBL{"$blist[0]"} > $numberoftries; } ; } ; $rv }) { }
1195 0 0 if ($csize and $answer == A1272() || $answer == A1274() || $answer == A1277())
1204 0 0 if exists $$DNSBL{$blist[0]}
1205 0 0 $notRHBL ? :
1206 0 0 $txt ? :
1224 0 0 $FATans ? :
1228 0 0 if ($FATans)
1240 0 0 if ($Otype == T_A()) { }
0 0 elsif ($Otype == T_AAAA()) { }
1252 0 0 if ($eXT and exists $$eXT{'ANSWER'} and $$eXT{'ANSWER'}($eXT, $get, $put, $rid, $ttl, \$nmsg, \%remoteThreads))
1257 0 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_ANSTOP
1261 0 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1266 0 0 if (not @blist) { }
1269 0 0 unless $deadDNSBL{"$blist[0]"} > $numberoftries
1275 0 0 unless $eXT and exists $$eXT{'NOTFOUND'} and $$eXT{'NOTFOUND'}($eXT, $get, $put, $rid, $rip, \$type, \$zone, \$msg, \%remoteThreads)
1280 0 0 unless $newstat
1286 0 0 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1292 0 0 if ($DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE)
1293 0 0 if ($answer) { }
1306 0 10 unless ($now < $next)
1308 0 0 if $prp < 0
1310 0 10 unless $prpshadow < 0
1312 5 5 unless $remoteThreads{$rid}{'expire'} < $now
1316 0 5 if (++$deadDNSBL{"$blist[0]"} > $numberoftries)
1318 0 0 if ($LogLevel)
1323 1 4 if ($blist[0] eq 'in-addr.arpa') { }
1 3 elsif (do { print STDERR '?' if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE; my $rv = 0; until ($rv) { shift @blist; if (not @blist) { $rv = 1; } else { last unless $deadDNSBL{"$blist[0]"} > $numberoftries; } ; } ; $rv }) { }
1326 1 0 exists $$DNSBL{$blist[0]} ? :
1346 0 1 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1349 0 4 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1353 1 3 if (not @blist) { }
1356 3 0 unless $deadDNSBL{"$blist[0]"} > $numberoftries
1362 0 0 unless $eXT and exists $$eXT{'NOTFOUND'} and $$eXT{'NOTFOUND'}($eXT, $get, $put, $rid, $rip, \$type, \$BLzone, \$msg, \%remoteThreads)
1367 1 0 unless $newstat
1369 0 1 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1374 0 3 if $DEBUG & $Net::DNSBL::MultiDaemon::D_VERBOSE
1378 0 26 if $deadDNSBL{"$_"} > $numberoftries
1380 1 9 if ($newstat > 1 or $refresh < $now and $newstat)
1386 0 10 if $DEBUG & $Net::DNSBL::MultiDaemon::D_TIMONLY
1389 0 24 if $newstat
1399 2 0 $type == T_A() || $type == T_ANY() ? :
1400 0 2 ($type == T_ANY() || $type == T_TXT()) && $withtxt ? :
1401 0 2 $CD ? :
1411 2 0 if ($haveA)
1415 0 2 if ($haveT)
1457 31 23 $_[0] ? :
1458 0 54 if $id < 1 or $id > 65534
1464 23 4 unless $rid
1470 0 27 $blist[0] eq 'genericPTR' ? :
1474 1 26 $blist eq 'in-addr.arpa' ? :
1479 0 27 if ($$rtp{$rid}{'urbl'}) { }
1484 0 27 unless exists $$rtp{$rid}