Branch Coverage

blib/lib/Mail/SMTP/Honeypot.pm
Criterion Covered Total %
branch 121 326 37.1


line true false branch
380 0 0 unless ref $_[0] eq 'HASH'
385 0 0 unless make_pidfile($pidfile, $$)
393 0 0 unless $me
394 0 0 if $_[0]
411 0 0 if ($pid) { }
447 0 0 unless ($$c{'piddir'} and -d $$c{'piddir'} and -w $$c{'piddir'})
454 0 0 if grep(($_ eq '-d'), @ARGV) and @ARGV < 2 or @ARGV < 1
459 0 0 if ($_ eq 'start') { }
0 0 elsif ($_ eq 'stop') { }
0 0 elsif ($_ eq 'restart') { }
0 0 elsif ($_ eq 'status') { }
0 0 elsif ($_ eq '-d') { }
473 0 0 if ($pid) { }
496 0 4 if ($$c{'ip_address'}) { }
497 0 0 unless $laddr = inet_aton($$c{'ip_address'})
503 0 4 if ($port = $$c{'port'}) { }
504 0 0 unless vld_num($port)
510 0 4 if ($delay = $$c{'delay'}) { }
511 0 0 unless vld_num($delay)
517 0 4 if ($deny = $$c{'deny'}) { }
519 0 0 unless $deny =~ /^(?:CONN|EHLO|HELO|MAIL|RCPT|DATA)$/
521 0 0 if $deny =~ /HELO|EHLO/
528 0 4 if ($log_facility = $$c{'log_facility'}) { }
530 0 0 unless $log_facility =~ /^(?:LOG_KERN|LOG_USER|LOG_MAIL|LOG_DAEMON|LOG_AUTH|LOG_SYSLOG|LOG_LPR|LOG_NEWS|LOG_UUCP|LOG_CRON|LOG_AUTHPRIV|LOG_FTP|LOG_LOCAL0|LOG_LOCAL1|LOG_LOCAL2|LOG_LOCAL3|LOG_LOCAL4|LOG_LOCAL5|LOG_LOCAL6|LOG_LOCAL7)$/
535 0 4 if ($syslog = $$c{'syslog'})
537 0 0 unless $syslog =~ /^(?:STDERR|LOG_EMERG|LOG_ALERT|LOG_CRIT|LOG_ERR|LOG_WARNING|LOG_NOTICE|LOG_INFO|LOG_DEBUG)$/
541 0 4 if ($verbose = $$c{'verbose'}) { }
542 0 0 unless vld_num($verbose) and $verbose > 0
545 0 0 if ($verbose > 3)
557 0 4 if ($_ = $$c{'dnshost'}) { }
558 0 0 unless $dnshost = inet_aton($_)
564 0 4 if ($dnsport = $$c{'dnsport'}) { }
565 0 0 unless vld_num($dnsport)
570 4 0 if ($dnshost)
574 0 4 if ($DNStimeout = $$c{'DNStimeout'}) { }
575 0 0 unless vld_num($DNStimeout) and $DNStimeout >= $delay
581 0 4 if ($maxthreads = $$c{'maxthreads'}) { }
582 0 0 unless vld_num($maxthreads)
588 0 4 if ($maxcmds = $$c{'maxcmds'}) { }
589 0 0 unless vld_num($maxcmds)
595 0 4 if ($disconnect = $$c{'disconnect'}) { }
596 0 0 unless vld_num($disconnect)
605 0 0 if ($pid)
611 0 0 unless open STDIN, '/dev/null'
612 0 0 unless open STDOUT, '>/dev/null'
614 0 0 if $pid = fork
618 3 1 wantarray ? :
624 0 0 unless $dns = open_udpNB()
657 0 0 unless ($syslog and $syslog eq 'STDERR')
658 0 0 unless open STDERR, '>/dev/null'
671 0 0 unless $sock
685 0 0 if $$threads{$_}{'read'}
686 0 0 if $$threads{$_}{'write'}
691 0 0 if ($nfound > 0) { }
0 0 elsif ($delta = ($_ = time) - $then) { }
692 0 0 if $wout
693 0 0 if $rout
699 0 0 unless exists $$threads{$_}
701 0 0 if ($$tptr{'alarm'} and $$tptr{'alarm'} + $delay < $then)
705 0 0 if ($$tptr{'tout'}) { }
712 0 0 if ($verbose > 3) { }
0 0 elsif ($verbose > 2) { }
713 0 0 &who . "delay ended for '${_}' $logtxt => " . exists($subref{$go}) ? :
721 0 0 if (exists $$threads{$_} and not $$threads{$_}{'tout'})
728 0 0 if ($$dns{$_}{'alarm'} and $$dns{$_}{'alarm'} + $delay < $then)
730 0 0 unless $verbose < 3
750 0 10 unless $verbose < 3
752 5 5 if ($sort) { }
758 5 33 unless exists $$threads{$_} and $$threads{$_}
759 16 17 unless vec $vec, $_, 1
760 12 5 unless $$threads{$_}{$op}
763 0 5 unless ref $go
765 0 5 if ($verbose > 3) { }
0 5 elsif ($verbose > 2) { }
766 0 0 exists $subref{$go} ? :
770 0 0 unless $verbose < 3
781 1 1 if fileno $$tptr{'sock'}
787 1 1 if (defined $wrote) { }
793 0 2 unless $verbose < 3
794 1 1 if (defined $wrote) { }
1 0 elsif (sockerror($! || 9)) { }
796 1 0 if ($$tptr{'woff'} == $bytes)
798 0 1 unless ($verbose < 4)
799 0 0 exists $subref{$go} ? :
813 3 0 if fileno $$tptr{'sock'}
818 0 0 defined $bytes ? :
0 3 unless $verbose < 3
825 2 1 if (defined $bytes) { }
0 1 elsif (sockerror($! || 9)) { }
826 1 1 unless $bytes
831 0 1 unless ($verbose < 4)
832 0 0 exists $subref{$go} ? :
849 2 1 $err ? :
3 3 $err == 4 || $err == 11 ? :
862 0 3 unless $verbose < 3
865 3 0 if $sock
876 0 2 if (keys %$threads > $maxthreads)
877 0 0 unless $verbose < 2
882 1 1 unless $sock
884 0 1 unless ($ipaddr)
908 0 1 if ($deny eq 'CONN') { }
950 0 0 unless $verbose < 3
989 0 21 if ++$$tptr{'cmdcnt'} > $maxcmds
992 18 3 if ($$tptr{'rargs'} =~ /^\s*([a-zA-Z]{4})\b/)
998 3 18 if (not $newc) { }
1 17 elsif (not exists $Commands{$newc}) { }
1 16 elsif ($$tptr{'roff'} > 512) { }
7 9 elsif ($lastc =~ /(?:CONN|HELO|EHLO)/) { }
8 1 elsif ($lastc eq 'MAIL') { }
1 0 elsif ($lastc eq 'RCPT') { }
1009 2 5 if ($newc eq 'RCPT') { }
2 3 elsif ($newc eq 'DATA') { }
1017 1 7 if ($newc eq 'MAIL') { }
1 6 elsif ($newc eq 'DATA') { }
1025 0 1 if ($newc eq 'MAIL')
1030 11 10 if ($$tptr{'wargs'}) { }
1 9 elsif ($newc eq $deny) { }
1031 0 11 unless $verbose < 2
1037 0 1 unless $verbose < 3
1039 0 9 unless $verbose < 3
1054 8 0 $string =~ /[^\s:]+/ ? :
1057 0 8 unless $what eq $match and $string =~ /^:/
1061 3 5 if ($string =~ /([\w\.-]+)@([\w\-]+\.[\w\.-]+)/)
1062 0 3 if length $1 > 64
1064 0 3 if length $2 > 255
1068 0 5 if $string =~ /^\s*?\s*$/ and $match =~ /to|vrfy/
1070 0 5 if $string =~ /^\s*<\s*>/ and $match =~ /from/
1076 0 5 if @_ > 1
1078 5 0 if $_[0]
1096 2 3 $smtp_args =~ /[\w\.-]+/ ? :
1101 2 3 if ($is_EHLO) { }
1124 1 2 if (not defined $domain) { }
1131 0 2 unless $verbose < 1
1148 2 3 if ($is_rcpt) { }
1153 1 4 if (defined $domain) { }
1154 1 0 $domain ? :
1155 0 1 $is_rcpt ? :
1157 0 1 $is_rcpt ? :
1158 0 1 unless $verbose < 1
1242 0 2 unless $verbose < 2
1273 1 2 $proto eq 'ESMTP' ? :
3 2 $domain ? :
1288 0 0 if $immediate
1314 0 0 if ($syslog and $syslog ne 'STDERR')
1331 0 0 unless $syslog
1334 0 0 if ($syslog eq 'STDERR') { }
1353 0 0 if $syslog and $syslog ne 'STDERR'
1359 14 30 if $seed
1360 2 42 if ++$unique > 65535
1391 0 0 unless $dnsaddr and $DNSfileno
1394 0 0 unless $verbose < 3
1407 0 0 unless $buffer
1426 0 0 unless $sender
1427 0 0 if length $msg < HFIXEDSZ()
1432 0 0 unless $tc == 0 and $qr == 1 and $opcode == QUERY() and $rcode == NOERROR() || $rcode == NXDOMAIN() || $rcode == SERVFAIL() and $qdcount == 1 and exists $$dns{$id}
1442 0 0 unless exists $$threads{$pfno}
1443 0 0 unless length $msg > HFIXEDSZ()
1448 0 0 if ($ancount and $rcode == &NOERROR and $lname eq $pname and $type == T_PTR() and $class == C_IN())
1456 0 0 if $t == T_PTR()
1460 0 0 if ($name) { }
1462 0 0 unless $verbose < 3
1465 0 0 unless $verbose < 3
1467 0 0 unless $$threads{$pfno}{'cok'}