Branch Coverage

blib/lib/TipJar/MTA.pm
Criterion Covered Total %
branch 42 386 10.8


line true false branch
10 0 2 if ($ENV{'TJMTADEBUG'}) { }
64 0 0 unless $_[1]
65 0 0 if $_[1] <= 0.14
67 0 0 if $_[1] > $TipJar::MTA::VERSION
97 0 2 if (grep {/^nodns$/i;} @_) { }
100 0 0 if (exists $TipJar::MTA::SMTProutes{$host})
101 0 0 if ref $TipJar::MTA::SMTProutes{$host}
105 0 0 if (exists $TipJar::MTA::SMTProutes{'SMARTHOST'})
106 0 0 if ref $TipJar::MTA::SMTProutes{'SMARTHOST'}
116 0 2 unless eval 'use Net::DNS; 1'
137 2 3 if (time - $LogTime > 30)
142 2 3 unless defined $TipJar::MTA::Recipient
144 0 5 unless open LOG, ">>$TipJar::MTA::basedir/log/current"
145 0 5 unless flock LOG, 2
146 5 0 if ($TipJar::MTA::LogToStdout) { }
176 0 0 if $e =~ /^\.\.?$/
178 0 0 if (-d $abs) { }
0 0 elsif (-f _) { }
188 0 0 unless rename $abs, "$TipJar::MTA::basedir/immediate/$e$ext"
194 0 0 unless unlink $abs
199 0 0 unless rmdir $e
212 0 2 unless -d $TipJar::MTA::basedir or mkdir $TipJar::MTA::basedir, 504
216 0 2 unless -w $TipJar::MTA::basedir
219 0 2 unless -d "$TipJar::MTA::basedir/log" or mkdir "$TipJar::MTA::basedir/log", 504
224 0 2 unless -d "$TipJar::MTA::basedir/queue" or mkdir "$TipJar::MTA::basedir/queue", 504
229 0 2 unless -d "$TipJar::MTA::basedir/domain" or mkdir "$TipJar::MTA::basedir/domain", 504
234 0 2 unless -d "$TipJar::MTA::basedir/4error" or mkdir "$TipJar::MTA::basedir/4error", 504
239 0 2 unless -d "$TipJar::MTA::basedir/5error" or mkdir "$TipJar::MTA::basedir/5error", 504
244 0 2 unless -d "$TipJar::MTA::basedir/conerror" or mkdir "$TipJar::MTA::basedir/conerror", 504
249 0 2 unless -d "$TipJar::MTA::basedir/temp" or mkdir "$TipJar::MTA::basedir/temp", 504
253 2 0 unless ($ONCE)
257 0 2 unless open PID, "+<$TipJar::MTA::basedir/temp/MTApid"
262 0 2 if ($oldpid and kill 0, $oldpid)
276 0 2 unless -d "$TipJar::MTA::basedir/immediate" or mkdir "$TipJar::MTA::basedir/immediate", 504
284 0 2 unless ++$count % $TipJar::MTA::TimeStampFrequency
287 0 2 if rand 1000 < 1
289 0 2 if ($ActiveKids > $TipJar::MTA::MaxActiveKids)
296 0 2 if $ONCE
297 1 1 unless $TipJar::MTA::LastChild = fork
299 1 0 if ($TipJar::MTA::OnlyOnce)
317 10 0 unless -f "$TipJar::MTA::basedir/$file"
318 0 0 unless -s "$TipJar::MTA::basedir/$file"
322 0 0 unless (rename "$TipJar::MTA::basedir/$file", $outfile = "$TipJar::MTA::basedir/temp/$$-" . $outboundfname++ . time)
330 0 0 unless (open MESSAGE0, "<$outfile")
351 0 0 unless (@MessData)
357 0 0 unless ($TipJar::MTA::Domain) = $Recip =~ /\@([\w\-\.]+)/
366 0 0 unless open TEMP, ">$TipJar::MTA::basedir/temp/$time.$$.$string"
371 0 0 unless rename "$TipJar::MTA::basedir/temp/$time.$$.$string", "$TipJar::MTA::basedir/immediate/$time.$$.$string.$bestmx"
380 0 1 unless opendir BASEDIR, "$TipJar::MTA::basedir/immediate"
384 2 0 unless my $M = newmessage("$TipJar::MTA::basedir/immediate/$file")
399 0 2 if (-f "$qdir/$this")
404 0 2 unless (-d "$qdir/$this")
407 0 0 unless unlink "$qdir/$this"
411 2 0 if $this =~ /^\.\.?$/
413 0 0 if ($this < $NEXTPIECE)
418 1 0 unless -d $qdir
421 1 0 unless $ONCE
436 2 0 unless -f $messageID
437 0 0 unless (-s $messageID)
444 0 0 unless open MESSAGE, "<$messageID"
445 0 0 unless flock MESSAGE, 6
464 0 0 if /^\.{1,2}$/
466 0 0 if -d "$dir/$_"
467 0 0 unless -f "$dir/$_"
470 0 0 if ($now - $mtime > 14400)
471 0 0 unless unlink "$dir/$_"
478 0 0 unless $nonempty
490 0 0 if m[error/\.\.?$]
508 0 0 unless -f "$TipJar::MTA::basedir/conerror/$_[0]"
510 0 0 if time - $SR[9] < $TipJar::MTA::ConRetryDelay
513 0 0 unless unlink "$TipJar::MTA::basedir/conerror/$_[0]"
520 0 0 unless my($user, $host) = split(/@/, $_[0], 2)
525 0 0 unless -d "$TipJar::MTA::basedir/4error/$host" or mkdir "$TipJar::MTA::basedir/4error/$host", 504
536 0 0 unless my($user, $host) = split(/@/, $_[0], 2)
541 0 0 unless -d "$TipJar::MTA::basedir/4error/$host"
542 0 0 unless -f "$TipJar::MTA::basedir/4error/$host/$user"
548 0 0 if (time - $ctime > $TipJar::MTA::FourErrCacheLifetime)
551 0 0 unless unlink "$TipJar::MTA::basedir/4error/$host/$user"
560 0 0 unless my($user, $host) = split(/@/, $_[0], 2)
565 0 0 unless -d "$TipJar::MTA::basedir/5error/$host" or mkdir "$TipJar::MTA::basedir/5error/$host", 504
568 0 0 unless open CACHE, ">$TipJar::MTA::basedir/5error/$host/$user.TMP$$"
576 0 0 unless my($user, $host) = split(/@/, $_[0], 2)
581 0 0 unless -d "$TipJar::MTA::basedir/5error/$host"
582 0 0 unless -f "$TipJar::MTA::basedir/5error/$host/$user"
589 0 0 if (time - $ctime > 14400)
592 0 0 unless unlink "$TipJar::MTA::basedir/5error/$host/$user"
615 0 2 if (exists $TipJar::MTA::SMTProutes{$host})
616 0 0 if ref $TipJar::MTA::SMTProutes{$host}
620 0 2 if (exists $TipJar::MTA::SMTProutes{'SMARTHOST'})
621 0 0 if ref $TipJar::MTA::SMTProutes{'SMARTHOST'}
627 0 2 unless @mx
647 0 0 if (defined $hersockaddr) { }
660 0 0 if (eofSOCK)
667 0 0 unless (print SOCK "$_[0]$CRLF")
682 0 0 if ($TipJar::MTA::timeout)
686 0 0 if (eofSOCK)
691 0 0 if ($letter eq "\r" or $letter eq "\n") { }
696 0 0 if (length $letter) { }
722 0 0 unless $TipJar::MTA::ReturnAddress =~ /\@/
743 0 0 unless defined(my $lin = )
753 0 0 unless $onioning
766 0 0 if (defined $TipJar::MTA::Domain and $TipJar::MTA::Domain and $TipJar::MTA::Recipient =~ /\@$TipJar::MTA::Domain$/i)
767 0 0 unless eofSOCK
770 0 0 unless (($TipJar::MTA::Domain) = $TipJar::MTA::Recipient =~ /\@([^\s>]+)/)
773 0 0 unless unlink $$message
782 0 0 if (concachetest $TipJar::MTA::Domain)
791 0 0 unless (@dnsmxes)
797 0 0 if cache4test $TipJar::MTA::Recipient
799 0 0 if cache5test $TipJar::MTA::Recipient
810 0 0 unless (@GHBNres = gethostbyname $Peerout)
811 0 0 if ($dnsmx_count == 1 and $Peerout eq $TipJar::MTA::Domain)
820 0 0 unless my $iaddr = $GHBNres[4]
822 0 0 unless socket SOCK, 2, 1, getprotobyname 'tcp'
825 0 0 if (defined $TipJar::MTA::BindAddress)
826 0 0 unless bind SOCK, sockaddr_in(0, inet_aton($TipJar::MTA::BindAddress))
830 0 0 unless connect SOCK, $paddr
850 0 0 unless unlink $$message
851 0 0 if $onioning
852 0 0 unless $ONCE
862 0 0 unless defined($TipJar::MTA::line = )
863 0 0 if ($@ or ++$Greetingcounter > 20)
876 0 0 if @GreetArr > 1
881 0 0 unless $TipJar::MTA::line = getresponse("EHLO $TipJar::MTA::MyDomain")
882 0 0 unless ($TipJar::MTA::line =~ /^250[ \-]/)
884 0 0 unless $TipJar::MTA::line = getresponse("HELO $TipJar::MTA::MyDomain")
885 0 0 unless ($TipJar::MTA::line =~ /^250[ \-]/)
893 0 0 unless $TipJar::MTA::line = getresponse('RSET')
899 0 0 unless ($TipJar::MTA::line =~ /^250[ \-]/)
912 0 0 unless $TipJar::MTA::line = getresponse("MAIL FROM:<$TipJar::MTA::ReturnAddress>")
914 0 0 unless ($TipJar::MTA::line =~ /^[2]/)
916 0 0 if ($TipJar::MTA::line =~ /^[4]/)
920 0 0 if ($TipJar::MTA::line =~ /^[5]/)
932 0 0 if (@TipJar::MTA::Recipients > 1)
947 0 0 unless $TipJar::MTA::line = getresponse("RCPT TO:<$_>")
948 0 0 if ($TipJar::MTA::line =~ /^2/) { }
953 0 0 if ($TipJar::MTA::line =~ /^4/) { }
0 0 elsif ($TipJar::MTA::line =~ /^5/) { }
954 0 0 if (@TipJar::MTA::Recipients > 1) { }
968 0 0 if (@TipJar::MTA::Recipients > 1) { }
969 0 0 if (/\@$TipJar::MTA::Domain$/) { }
991 0 0 if (@recips4 + @recips5)
994 0 0 if (@recips5 == @TipJar::MTA::Recipients)
1011 0 0 if (@recips4)
1015 0 0 if (@recips4 > 1) { }
1020 0 0 if @recips4
1048 0 0 unless $TipJar::MTA::ReturnAddress =~ /\@/
1052 0 0 if ($TipJar::MTA::ReturnAddress =~ /$_/)
1082 0 0 unless defined(my $lin = )
1095 0 0 if $TipJar::MTA::PostDataTrouble
1102 0 0 unless $TipJar::MTA::line = getresponse('DATA')
1103 0 0 unless ($TipJar::MTA::line =~ /^354 /)
1105 0 0 if (@GoodR == 1)
1106 0 0 if ($TipJar::MTA::line =~ /^4/)
1109 0 0 if ($TipJar::MTA::line =~ /^5/)
1122 0 0 unless print SOCK "X-Tipjar-Mta-Transmitted-By: $TipJar::MTA::MyDomain\r\n"
1129 0 0 if ($_ eq '.') { }
1130 0 0 unless print SOCK "..\r\n"
1133 0 0 unless print SOCK $_, "\r\n"
1136 0 0 if ($@)
1146 0 0 unless $TipJar::MTA::line = getresponse('.')
1147 0 0 unless ($TipJar::MTA::line =~ /^2/)
1149 0 0 if ($TipJar::MTA::line =~ /^4/)
1152 0 0 if @recips4 > 1
1156 0 0 if ($TipJar::MTA::line =~ /^5/)
1173 0 0 unless $TipJar::MTA::ReturnAddress =~ /\@/
1179 0 0 if ($TipJar::MTA::ReturnAddress =~ /$_/)
1188 0 0 unless defined $TipJar::MTA::line
1189 0 0 unless defined $TipJar::MTA::Recipient
1190 0 0 unless defined $TipJar::MTA::ReturnAddress
1191 0 0 unless defined $Peerout
1215 0 0 unless defined(my $lin = )
1224 0 0 unless unlink $$message
1227 0 0 if ($onioning)
1231 0 0 if (-f "$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain") { }
1245 0 0 unless -f $_
1246 0 0 if (--$TipJar::MTA::ReuseQuota < 0 or eofSOCK)
1252 0 0 unless -f $_
1261 0 0 unless $M
1266 0 0 unless unlink "$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain.$$"
1273 0 0 unless eofSOCK
1282 0 0 unless (-f $$message)
1293 0 0 if ($age > 604800)
1295 0 0 unless $TipJar::MTA::ReturnAddress =~ /\@/
1320 0 0 unless defined(my $lin = )
1328 0 0 unless unlink $$message
1335 0 0 if ($age > $TipJar::MTA::AgeBeforeDeferralReport and $reason and $TipJar::MTA::ReturnAddress =~ /\@/)
1366 0 0 unless defined(my $lin = )
1385 0 0 unless -d $dir or mkdir $dir, 511
1393 0 0 if $TipJar::MTA::ConnectionProblem
1400 0 0 unless rename "$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain", "$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain$$"
1411 0 0 unless unlink "$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain$$"
1415 0 0 unless open DOMAINLISTLOCK, ">>$TipJar::MTA::basedir/domain/.lock"
1419 0 0 unless open DOMAINLIST, ">>$TipJar::MTA::basedir/domain/$TipJar::MTA::Domain"