Branch Coverage

lib/Mail/Toaster.pm
Criterion Covered Total %
branch 42 408 10.2


line true false branch
24 0 11 unless my $mess = shift()
28 0 11 if defined $p{'test_ok'}
30 11 0 unless $self->verbose
32 0 0 unless (defined $result)
34 0 0 $result ? :
64 1 0 unless -f $conf
67 0 0 if my $others = substr($mode, -1, 1)
75 1 0 unless -f $conf
80 0 0 if $others == 0
93 1 0 if $conf->{'install_lighttpd'}
94 0 1 if $conf->{'install_mysqld'}
95 0 1 if $conf->{'install_snmp'}
96 1 0 if $conf->{'install_clamav'}
97 0 1 if $conf->{'install_sqwebmail'}
98 1 0 if $conf->{'install_dovecot'}
99 0 1 if $conf->{'vpopmail_daemon'}
100 1 0 if ($conf->{'install_courier_imap'})
103 1 0 if $cour eq 'port' or $cour > 4
116 1 0 if $Mail::Toaster::OSNAME ne 'freebsd'
119 0 0 unless -f '/usr/local/dcc/libexec/cron-dccd'
122 0 0 unless (-d $periodic_dir)
123 0 0 unless $self->util->mkdir_system('dir', $periodic_dir, 'mode', '0755')
128 0 0 if -f $script
140 0 1 unless my $logfile = $self->conf->{'toaster_watcher_log'}
141 1 0 unless -e $logfile
144 0 0 unless my $size = &Mail::Toaster::stat($logfile)->size
145 0 0 if $size < 999999
154 0 0 unless $self->conf->{'vpopmail_roaming_users'}
159 0 0 unless (-x $clearbin)
169 0 0 if defined $p{'test_ok'}
172 0 0 unless my $days = $self->conf->{'maildir_learn_interval'}
177 0 0 unless (-d $d)
185 0 0 if (-f "$d/learn.log")
190 0 0 unless $counter->{'ham'} or $counter->{'spam'}
209 0 0 if $dir =~ /(?:spam|junk)/i
213 0 0 if $counter{$type} > 10000 and $counter{$type} % 50 != 0
214 0 0 if $counter{$type} > 5000 and $counter{$type} % 25 != 0
215 0 0 if $counter{$type} > 2500 and $counter{$type} % 10 != 0
229 0 0 unless $self->{'install_spamassassin'}
234 0 0 unless scalar @$list
243 0 0 unless ($self->conf->{'install_dspam'})
246 0 0 unless (-f $file)
249 0 0 unless (-x $dspam)
253 0 0 if ($type eq 'ham') { }
0 0 elsif ($type eq 'spam') { }
255 0 0 if ($dspam_class) { }
256 0 0 if ($dspam_class eq 'innocent')
260 0 0 if ($dspam_class eq 'spam')
270 0 0 if ($dspam_class) { }
271 0 0 if ($dspam_class eq 'spam') { }
0 0 elsif ($dspam_class eq 'innocent') { }
292 0 1 if defined $p{'test_ok'}
295 0 1 unless my $days = $self->conf->{'maildir_clean_interval'}
298 0 0 if (-M $clean_log <= $days)
302 0 0 unless $self->util->logfile_append($clean_log, 'prog', $0, 'lines', ['clean_mailboxes running.'])
312 0 0 unless ($maildir and -d $maildir)
330 0 0 unless my $path = shift()
331 0 0 unless my $days = $self->conf->{'maildir_clean_Spam'}
338 0 0 unless -d $dir
344 0 0 if ($dir =~ /(?:cur|new)$/) { }
356 0 0 unless my $path = shift()
357 0 0 unless my $days = $self->conf->{'maildir_clean_Trash'}
363 0 0 unless my $path = shift()
364 0 0 unless my $days = $self->conf->{'maildir_clean_Sent'}
370 0 0 unless my $path = shift()
371 0 0 unless my $days = $self->conf->{'maildir_clean_Unread'}
377 0 0 unless my $path = shift()
378 0 0 unless my $days = $self->conf->{'maildir_clean_Read'}
384 4 1 unless $active
387 0 1 if $self->conf->{'vpopmail_daemon'}
388 1 0 if $self->conf->{'install_qmail_deliverable'}
391 0 1 if ($smtpd and 'qpsmtpd' eq $smtpd) { }
398 1 0 if ($self->conf->{'submit_enable'})
399 1 0 if (not $self->conf->{'submit_daemon'} or 'qmail' eq $self->conf->{'submit_daemon'})
421 1 0 unless (-e $clean_log)
423 0 0 unless -e $clean_log
430 0 0 unless (-f $file)
441 0 0 unless $dspam_status and $signature
442 0 0 unless my($class) = $dspam_status =~ /^X-DSPAM-Result:\s+([\w]+)\,/
459 0 0 unless $all_domains[0]
492 0 0 if $maildir =~ m[\.Notes/cur$]i
493 0 0 if $maildir =~ /\.Apple/i
494 0 0 if $maildir =~ /drafts|sent/i
495 0 0 if $maildir =~ /trash|delete/i
508 0 0 if -f $_ and &Mail::Toaster::stat($_)->ctime > $oldest
523 0 0 if (defined $self->conf and $self->conf->{'toaster_http_docs'})
536 0 0 if -d $dir
546 0 0 if defined $self->conf->{'toaster_cgi_bin'}
549 0 0 if -d '/usr/local/www/cgi-bin.mail'
550 0 0 if -d '/usr/local/www/cgi-bin'
551 0 0 if -d '/var/www/cgi-bin'
554 0 0 if (-d '/Library/WebServer/CGI-Executables')
559 0 0 $Mail::Toaster::OSNAME eq 'netbsd' ? :
0 0 $Mail::Toaster::OSNAME eq 'darwin' ? :
0 0 $Mail::Toaster::OSNAME eq 'linux' ? :
575 0 0 if $smtpd eq 'qmail'
576 0 0 if $conf->{'submit_enable'} and $submit eq 'qmail'
577 0 0 if $pop3_logs eq 'qpop3d'
580 0 0 if $smtpd eq 'qmail'
581 0 0 if $pop3_logs eq 'qpop3d'
583 0 0 if $conf->{'logs_archive_purge'}
590 0 0 unless $self->conf->{'install_isoqlog'}
592 0 0 unless my $isoqlog = $self->util->find_bin('isoqlog', 'verbose', 0)
594 0 0 unless system "$isoqlog >/dev/null"
600 0 0 unless $self->conf->{'install_qmailscanner'}
601 0 0 unless $self->conf->{'qs_quarantine_process'}
606 0 0 unless $self->conf->{'qs_block_virus_senders'}
612 0 4 unless my $prot = shift()
614 0 4 if $prot eq 'smtpd'
617 0 4 unless $valid{$prot}
620 0 4 if not -d $svcdir and -d '/service'
635 0 0 unless my $r = $self->$method
644 0 0 unless (-d $supdir)
649 0 0 if (-e $svcdir)
655 0 0 unless symlink $supdir, $svcdir
665 0 0 if ($self->conf->{'pop3_daemon'} and $self->conf->{'pop3_daemon'} eq 'qpop3d')
675 0 0 if my $enabled = $self->conf->{'vpopmail_daemon'}
689 0 0 unless my $daemon = $self->conf->{'smtpd_daemon'}
691 0 0 if ($daemon eq 'qmail')
696 0 0 if ($daemon eq 'qpsmtpd')
706 0 0 unless $self->conf->{'submit_enable'}
708 0 0 unless my $daemon = $self->conf->{'submit_daemon'}
710 0 0 if ($daemon eq 'qpsmtpd')
723 0 0 unless (-e $dir)
736 0 0 if defined $p{'test_ok'}
740 0 0 unless (-d $service)
741 0 0 unless mkdir $service, 509
747 0 0 unless (-l '/service')
748 0 0 if (-d '/service')
760 0 0 unless -d $service
765 0 0 unless -l '/service' and -e '/service'
775 0 0 unless $self->conf->{'install_sqwebmail'}
777 0 0 unless -x $script
784 0 5 unless my $prot = shift()
787 0 5 if not -d $sdir and -d '/var/supervise'
788 0 5 if not -d $sdir and -d '/supervise'
794 0 5 if $dir =~ m[^qmail_supervise/(.*)$]
807 0 0 if defined $p{'test_ok'}
809 0 0 if (-d $supdir) { }
813 0 0 unless mkpath($supdir, 509)
821 0 0 if (-d $protdir)
826 0 0 unless mkdir $protdir, 509
830 0 0 unless mkdir "$protdir/log", 509
840 0 0 unless -e "$supdir/$prot"
846 0 5 unless my $prot = shift()
850 0 5 unless my $dir = $self->supervise_dir_get($prot)
852 5 0 if defined $p{'test_ok'}
854 0 0 unless -d $dir or -l $dir
858 0 0 unless (-f "$dir/run")
860 0 0 unless -f "$dir/run"
864 0 0 unless -x "$dir/run"
867 0 0 if -f "$dir/down"
874 0 0 if $log_method =~ /(?:syslog|disabled)/i
877 0 0 unless -d "$dir/log"
881 0 0 unless (-f "$dir/log/run")
883 0 0 unless -f "$dir/log/run"
889 0 0 unless -x "$dir/log/run"
893 0 0 if -f "$dir/log/down"
902 1 0 if ($vdir)
910 1 0 if $vdir
925 0 0 unless my $prot = shift()
930 0 0 if (not $prot or $prot eq 'system')
934 0 0 if ($prot eq 'qmail')
945 0 0 unless my $prot = shift()
952 0 0 unless -x $setuidgid and -x $multilog
957 0 0 $prot eq 'smtp' ? :
963 0 0 if ($method eq 'stats') { }
0 0 elsif ($method eq 'disabled') { }
969 0 0 if ($prot eq 'send' and $self->conf->{'send_log_isoqlog'})
979 0 0 unless my $prot = shift()
981 0 0 if ('syslog' eq $self->conf->{$prot . '_hostname'})
992 0 0 unless my $prot = shift()
994 0 0 if $Mail::Toaster::UID != 0
997 0 0 unless my $dir = $self->supervise_dir_get($prot)
999 0 0 unless -d $dir
1002 0 0 unless -f "$dir/run"
1006 0 0 unless my $svc = $self->util->find_bin('svc', 'verbose', 0, 'fatal', 0)
1014 0 0 unless my $dir = shift()
1016 0 0 unless -d $dir
1021 0 0 unless -x $svc
1024 0 0 if ($svok)
1025 0 0 if system "$svok $dir"
1037 0 1 unless my $prot = shift()
1041 1 0 $mem ? :
1049 0 0 if $self->conf->{$prot . '_lookup_tcpremotehost'} == 0
1050 0 0 if $self->conf->{$prot . '_lookup_tcpremoteinfo'} == 0
1051 0 0 if $self->conf->{$prot . '_dns_paranoia'} == 1
1052 0 0 if $self->conf->{$prot . '_verbose'}
1057 0 0 if ($maxmem)
1058 0 0 if ($mem / 1024000 * $maxcon > $maxmem)
1064 0 0 if $maxcon != 40
1066 0 0 if $self->conf->{$prot . '_dns_lookup_timeout'} != 26
1070 0 0 if ($prot =~ /^smtpd|submit$/)
1075 0 0 unless ($uid and $gid)
1085 0 0 $address eq 'all' ? :
1089 0 0 $prot eq 'pop3' ? :
0 0 $prot eq 'submission' ? :
0 0 $prot eq 'smtpd' ? :
1103 0 0 unless $self->conf->{$prot . '_use_mysql_relay_table'}
1108 0 0 if (grep /sql/, `$strings $tcpserver`)
1121 0 0 unless $cdb
1126 0 0 if ($cdb =~ m[^vpopmail_home_dir/(.*)$])
1131 0 0 unless (-e $cdb)
1136 0 0 unless -r $cdb