Branch Coverage

lib/Mail/Toaster/Logs.pm
Criterion Covered Total %
branch 0 518 0.0


line true false branch
27 0 0 if defined $p{'test_ok'}
30 0 0 unless my $qma_dir = $self->find_qmailanalog
38 0 0 unless (-s $send_log)
45 0 0 $send_log =~ /\.gz$/ ? :
0 0 $send_log =~ /\.bz2$/ ? :
97 0 0 unless (-d $qmailanalog_dir)
105 0 0 if (-d '/usr/local/qmailanalog/bin')
117 0 0 unless (-x "$qmailanalog_dir/matchup")
135 0 0 if ($self->conf->{'send_log_method'} and $self->conf->{'send_log_method'} eq 'syslog')
147 0 0 if -l "$logbase/sendlog"
154 0 0 if -l "$logbase/sendlog.gz"
164 0 0 if ($Mail::Toaster::Logs::OSNAME eq 'freebsd')
167 0 0 -e "$file.gz" ? :
0 0 -e "$file.bz2" ? :
172 0 0 if ($Mail::Toaster::Logs::OSNAME eq 'darwin')
178 0 0 -e "$file.bz2" ? :
0 0 -e "$file.gz" ? :
194 0 0 if -l "$logbase/smtplog"
202 0 0 if -l "$logbase/smtplog.gz"
211 0 0 if defined $p{'test_ok'}
219 0 0 unless (-e $logbase)
220 0 0 unless mkpath($logbase, 0, 493)
222 0 0 unless $self->util->chown($logbase, 'uid', $user, 'gid', $group)
225 0 0 if (-w $logbase)
226 0 0 unless $self->util->chown($logbase, 'uid', $user, 'gid', $group)
231 0 0 unless (-e $dir)
233 0 0 if $Mail::Toaster::Logs::EVAL_ERROR
234 0 0 unless $self->util->chown($dir, 'uid', $user, 'gid', $group)
236 0 0 unless -d $dir
239 0 0 unless -x $script
241 0 0 unless -e $script
242 0 0 unless -x $script
254 0 0 unless my $prot = $p{'prot'}
260 0 0 unless $valid_prots{$prot}
262 0 0 if $prot eq 'test'
266 0 0 if $prot eq 'smtp'
267 0 0 if $prot eq 'rbl'
268 0 0 if $prot eq 'send'
269 0 0 if $prot eq 'pop3'
270 0 0 if $prot eq 'imap'
271 0 0 if $prot eq 'spamassassin'
272 0 0 if $prot eq 'qmailscanner'
273 0 0 if $prot eq 'webmail'
274 0 0 if $prot eq 'yesterday'
298 0 0 if $verbose
302 0 0 if $i > 0
306 0 0 if $i > 0
317 0 0 if $verbose
320 0 0 if ($logfiles->[0] eq '')
333 0 0 unless $log_line =~ /vchkpw-(smtp|submission)/
337 0 0 if $log_line =~ /success/i
341 0 0 if ($new_entries{'success'})
350 0 0 if ($new_entries{'success'} >= $count_ref->{'success_last'}) { }
363 0 0 if ($new_entries{'connect'})
364 0 0 if ($new_entries{'connect'} >= $count_ref->{'connect_last'}) { }
376 0 0 unless defined $count_ref->{$_}
393 0 0 if $verbose
400 0 0 if ($Mail::Toaster::Logs::count_ref->{'status_remotep'} and $Mail::Toaster::Logs::count_ref->{'status'})
405 0 0 if $verbose
409 0 0 if $i > 0
427 0 0 if (@$logfiles[0] eq '')
437 0 0 unless $line =~ /imap/
441 0 0 if ($line =~ /imap-login/)
442 0 0 if ($line =~ /secured/) { }
447 0 0 if ($line =~ /ssl: LOGIN/)
452 0 0 if ($line =~ /LOGIN/)
463 0 0 unless ($lines)
469 0 0 if $verbose
473 0 0 if ($imap_success)
474 0 0 if ($imap_success >= $Mail::Toaster::Logs::count_ref->{'imap_success_last'}) { }
485 0 0 if ($imap_ssl_success)
486 0 0 if ($imap_ssl_success >= $Mail::Toaster::Logs::count_ref->{'imap_ssl_success_last'}) { }
510 0 0 if $verbose
514 0 0 if $verbose
516 0 0 if ($logfiles->[0] eq '')
521 0 0 if $verbose
543 0 0 unless (defined $Mail::Toaster::Logs::count_ref->{$key})
544 0 0 if $verbose
549 0 0 if $verbose
555 0 0 unless $line =~ /pop3/
558 0 0 if ($line =~ /vchkpw-pop3:/) { }
0 0 elsif ($line =~ /pop3d: /) { }
0 0 elsif ($line =~ /pop3d-ssl: /) { }
0 0 elsif ($line =~ /pop3-login: /) { }
560 0 0 if $line =~ /success/
563 0 0 if $line =~ /Connection/
564 0 0 if $line =~ /LOGIN/
567 0 0 if ($line =~ /LOGIN/)
571 0 0 if $line =~ /Connection/
574 0 0 if ($line =~ /secured/) { }
584 0 0 unless ($lines)
586 0 0 if $verbose
590 0 0 if ($new_entries{'success'})
591 0 0 if ($new_entries{'success'} >= $Mail::Toaster::Logs::count_ref->{'pop3_success_last'}) { }
602 0 0 if ($new_entries{'connect'})
603 0 0 if ($new_entries{'connect'} >= $Mail::Toaster::Logs::count_ref->{'pop3_connect_last'}) { }
612 0 0 if ($new_entries{'ssl_success'})
613 0 0 if ($new_entries{'ssl_success'} >= $Mail::Toaster::Logs::count_ref->{'pop3_ssl_success_last'}) { }
624 0 0 if ($new_entries{'ssl_connect'})
625 0 0 if ($new_entries{'ssl_connect'} >= $Mail::Toaster::Logs::count_ref->{'pop3_ssl_connect_last'}) { }
643 0 0 unless $Mail::Toaster::Logs::count_ref->{'pop3_connect'}
644 0 0 unless $Mail::Toaster::Logs::count_ref->{'pop3_ssl_connect'}
645 0 0 unless $Mail::Toaster::Logs::count_ref->{'pop3_success'}
646 0 0 unless $Mail::Toaster::Logs::count_ref->{'pop3_ssl_success'}
663 0 0 if (@$logfiles[0] eq '')
678 0 0 if $line =~ /spamd/
679 0 0 if $line =~ /pop3/
681 0 0 if ($line =~ /Successful webmail login/) { }
0 0 elsif ($line =~ /sqwebmaild/) { }
0 0 elsif ($line =~ /imapd: LOGIN/ and $line =~ /127\.0\.0\./) { }
687 0 0 unless $line =~ /FAILED/
697 0 0 unless ($temp{'connect'})
698 0 0 if $verbose
702 0 0 if ($temp{'success'})
703 0 0 if ($temp{'success'} >= $Mail::Toaster::Logs::count_ref->{'success_last'}) { }
712 0 0 if ($temp{'connect'})
713 0 0 if ($temp{'connect'} >= $Mail::Toaster::Logs::count_ref->{'connect_last'}) { }
722 0 0 unless ($Mail::Toaster::Logs::count_ref->{'connect'})
726 0 0 unless ($Mail::Toaster::Logs::count_ref->{'success'})
749 0 0 if (@$logfiles[0] eq '')
757 0 0 unless (open my $LOGF, '<', $_)
763 0 0 unless $line =~ /spamd/
766 0 0 if ($line =~ m[clean message \(([0-9-\.]+)/([0-9\.]+)\) for .* in ([0-9\.]+) seconds, ([0-9]+) bytes]) { }
0 0 elsif ($line =~ m[identified spam \(([0-9-\.]+)/([0-9\.]+)\) for .* in ([0-9\.]+) seconds, ([0-9]+) bytes]) { }
794 0 0 unless ($temp{'spamd_lines'})
795 0 0 if $verbose
802 0 0 if ($ham_count)
803 0 0 if ($ham_count >= $Mail::Toaster::Logs::count_ref->{'sa_ham_last'}) { }
812 0 0 if ($spam_count)
813 0 0 if ($spam_count >= $Mail::Toaster::Logs::count_ref->{'sa_spam_last'}) { }
824 0 0 defined $temp{'spam_scores'} && $spam_count ? :
827 0 0 defined $temp{'ham_scores'} && $ham_count ? :
830 0 0 $temp{'threshhold'} && ($ham_count || $spam_count) ? :
836 0 0 defined $temp{'ham_seconds'} && $ham_count ? :
839 0 0 defined $temp{'spam_seconds'} && $spam_count ? :
842 0 0 defined $temp{'ham_bytes'} && $ham_count ? :
845 0 0 defined $temp{'spam_bytes'} && $spam_count ? :
871 0 0 if (not defined @$logfiles[0] or @$logfiles[0] eq '')
885 0 0 if ($qs_all == 0)
886 0 0 if $verbose
890 0 0 if ($qs_clean)
891 0 0 if ($qs_clean >= $count_ref->{'qs_clean_last'}) { }
900 0 0 if ($qs_virus)
901 0 0 if ($qs_virus >= $count_ref->{'qs_virus_last'}) { }
912 0 0 unless ($count_ref)
924 0 0 if $verbose
943 0 0 if (-r $countfile)
971 0 0 unless my $file = shift()
978 0 0 if -e "$file.gz"
979 0 0 unless -e $file
980 0 0 unless $self->util->is_writable("$file.gz", 'fatal', 0)
983 0 0 unless my $gzip = $self->util->find_bin('gzip', 'fatal', 0)
984 0 0 unless $self->util->syscmd("$gzip $file", 'fatal', 0)
995 0 0 unless ($self->conf->{'logs_archive_purge'})
1000 0 0 unless my($dd, $mm, $yy) = $self->util->get_the_date('bump', 31)
1004 0 0 unless ($logbase and -d $logbase)
1011 0 0 unless (-d $last_m_log)
1012 0 0 if $verbose
1016 0 0 if $verbose
1017 0 0 if (rmtree($last_m_log))
1018 0 0 if $verbose
1029 0 0 unless $file and -e $file
1056 0 0 unless $files_ref and $files_ref->[0]
1058 0 0 if ($p{'roll'})
1061 0 0 unless ($skip_archive)
1062 0 0 unless $PIPE_TO_CRONOLOG = $self->get_cronolog_handle('pop3log')
1067 0 0 if $self->conf->{'logs_taifiles'}
1068 0 0 unless $skip_archive
1070 0 0 unless $skip_archive
1079 0 0 unless (open $MULTILOG_FILE, '<', $file)
1090 0 0 if $verbose
1109 0 0 unless $files_ref and $files_ref->[0]
1111 0 0 if ($p{'roll'})
1113 0 0 unless ($skip_archive)
1114 0 0 unless $PIPE_TO_CRONOLOG = $self->get_cronolog_handle('smtplog')
1120 0 0 if $self->conf->{'logs_taifiles'}
1121 0 0 unless $skip_archive
1123 0 0 unless $skip_archive
1128 0 0 if $verbose
1131 0 0 unless (open $MULTILOG_FILE, '<', $file)
1139 0 0 if $verbose
1147 0 0 unless my $line = shift()
1152 0 0 if ($line =~ /rblsmtpd/) { }
0 0 elsif ($line =~ /CHKUSER/) { }
0 0 elsif ($line =~ /simscan/i) { }
1154 0 0 if ($line =~ /spamhaus/) { }
0 0 elsif ($line =~ /spamcop/) { }
0 0 elsif ($line =~ /dsbl\.org/) { }
0 0 elsif ($line =~ /services/) { }
0 0 elsif ($line =~ /rfc-ignorant/) { }
0 0 elsif ($line =~ /sorbs/) { }
0 0 elsif ($line =~ /njabl/) { }
0 0 elsif ($line =~ /ORDB/) { }
0 0 elsif ($line =~ /mail-abuse/) { }
0 0 elsif ($line =~ /monkeys/) { }
0 0 elsif ($line =~ /visi/) { }
1171 0 0 if ($line =~ /CHKUSER acce/) { }
0 0 elsif ($line =~ /CHKUSER reje/) { }
1179 0 0 if ($line =~ /clean/i) { }
0 0 elsif ($line =~ /virus:/i) { }
0 0 elsif ($line =~ /spam rej/i) { }
1188 0 0 if ($line =~ /badhelo:/) { }
0 0 elsif ($line =~ /badmailfrom:/) { }
0 0 elsif ($line =~ /badmailto:/) { }
0 0 elsif ($line =~ /Reverse/) { }
1215 0 0 unless $files_ref and $files_ref->[0]
1217 0 0 if ($p{'roll'})
1219 0 0 if $verbose
1222 0 0 unless ($skip_archive)
1223 0 0 unless $PIPE_TO_CRONOLOG = $self->get_cronolog_handle('sendlog')
1229 0 0 if $self->conf->{'logs_taifiles'}
1230 0 0 unless $skip_archive
1232 0 0 unless $skip_archive
1236 0 0 if $verbose
1240 0 0 if $verbose
1243 0 0 unless (open $INFILE, '<', $file)
1261 0 0 unless (my $line = shift())
1282 0 0 unless ($activity)
1287 0 0 if ($activity =~ /^new msg/) { }
0 0 elsif ($activity =~ /^info msg /) { }
0 0 elsif ($activity =~ /^starting delivery/) { }
0 0 elsif ($activity =~ /^status: local/) { }
0 0 elsif ($activity =~ /^end msg/) { }
0 0 elsif ($activity =~ /^delivery/) { }
0 0 elsif ($activity =~ /^bounce/) { }
1311 0 0 if ($3 eq 'remote') { }
0 0 elsif ($3 eq 'local') { }
1341 0 0 if ($2 eq 'success') { }
0 0 elsif ($2 eq 'deferral') { }
0 0 elsif ($2 eq 'failure') { }
1366 0 0 if $verbose
1368 0 0 unless ($self->util->is_writable($file, 'verbose', 0, 'fatal', 0))
1369 0 0 if $verbose
1390 0 0 unless my $file = $p{'file'}
1393 0 0 unless (-e $file)
1394 0 0 unless $self->counter_create($file)
1424 0 0 if (-d $logfile)
1428 0 0 unless $self->util->is_writable($logfile, %args)
1431 0 0 unless (-e $logfile)
1444 0 0 if ($key and defined $value)
1447 0 0 if ($value > 4294967295)
1457 0 0 unless my $file = shift()
1463 0 0 unless ($self->conf->{'logs_archive'})
1464 0 0 if $verbose
1469 0 0 unless (-w $logbase)
1475 0 0 unless ($cronolog and -x $cronolog)
1482 0 0 if ($self->conf->{'logs_archive_untai'})
1485 0 0 unless ($taibin)
1489 0 0 if ($taibin and not -x $taibin)
1497 0 0 if $tai64nlocal
1501 0 0 unless open my $PIPE_TO_CRONOLOG, $cronolog_invocation
1512 0 0 if (-e $log)
1513 0 0 if $verbose
1518 0 0 if ($Mail::Toaster::Logs::OSNAME eq 'darwin')
1519 0 0 if $verbose
1523 0 0 if (-e $log)
1524 0 0 if $verbose
1529 0 0 if -e $log
1532 0 0 if -e $log