Branch Coverage

lib/Mail/Toaster/Qmail.pm
Criterion Covered Total %
branch 38 582 6.5


line true false branch
22 0 1 unless $self->get_supervise_dir
26 0 1 if ($self->conf->{'pop3_hostname'} eq 'qmail')
31 0 0 unless my $exec = $self->toaster->supervised_tcpserver('pop3')
32 0 0 unless my $chkpass = $self->_set_checkpasswd_bin('prot', 'pop3')
42 0 0 unless $self->util->file_write($file, 'lines', \@lines)
43 0 0 unless $self->install_supervise_run('tmpfile', $file, 'prot', 'pop3')
54 0 0 unless $self->get_supervise_dir
61 0 0 if ($send_log eq 'syslog') { }
73 0 0 unless $self->util->file_write($file, 'lines', \@lines, 'fatal', 0)
74 0 0 unless $self->install_supervise_run('tmpfile', $file, 'prot', 'send')
85 0 0 unless $self->_test_smtpd_config_values
93 0 0 unless $self->get_control_dir
94 0 0 unless $self->get_supervise_dir
97 0 0 if $self->conf->{'smtpd_hostname'} eq 'qmail'
101 0 0 unless my $exec = $self->toaster->supervised_tcpserver('smtpd')
103 0 0 if $self->conf->{'smtpd_recordio'}
104 0 0 if $self->conf->{'smtpd_fixcrio'}
107 0 0 unless $exec .= $self->toaster->supervised_log_method('smtpd')
112 0 0 unless $self->util->file_write($file, 'lines', \@smtp_run_cmd)
122 0 0 unless $self->conf->{'submit_enable'}
126 0 0 unless $self->_test_smtpd_config_values
131 0 0 unless $self->get_control_dir
132 0 0 unless $self->get_supervise_dir
143 0 0 if $self->conf->{'submit_hostname'} eq 'qmail'
146 0 0 unless my $exec = $self->toaster->supervised_tcpserver('submit')
150 0 0 if ($self->conf->{'submit_auth_enable'})
152 0 0 if $self->conf->{'submit_hostname'} and $self->conf->{'qmail_smtpd_auth_0.31'}
154 0 0 unless my $chkpass = $self->_set_checkpasswd_bin('prot', 'submit')
158 0 0 unless $exec .= $self->toaster->supervised_log_method('submit')
163 0 0 unless $self->util->file_write($file, 'lines', \@lines)
164 0 0 unless $self->install_supervise_run('tmpfile', $file, 'prot', 'submit')
179 0 0 unless $self->util->file_write($file, 'lines', \@lines)
180 0 0 unless $self->install_supervise_run('tmpfile', $file, 'prot', 'qmail-deliverable')
187 0 0 unless ($self->conf->{'vpopmail_daemon'})
205 0 0 unless $self->util->file_write($file, 'lines', \@lines, 'fatal', 0)
206 0 0 unless $self->qmail->install_supervise_run('tmpfile', $file, 'prot', 'vpopmaild')
221 0 0 unless (-d $qmaildir)
231 0 0 unless (-s $assign and -s $rcpt)
243 0 0 if -e "$qmaildir/control/morercpthosts"
252 0 0 unless ($rcpthosts{$domain})
259 0 0 if (not $count or $count == 0)
264 0 0 if ($domains > 50) { }
277 2 0 if defined $p{'test_ok'}
281 0 0 if $host =~ /(?:qmail|system)/
286 0 0 if ($ciphers =~ /^[a-z]+$/)
304 0 0 if $conf->{'vpopmail_mysql'}
319 0 0 if $Mail::Toaster::Qmail::OSNAME eq 'freebsd'
344 0 0 unless `grep NO_SENDMAIL /etc/make.conf`
355 0 0 unless open my $MAILER_CONF, '>', $tmp_mailer_conf
395 0 0 unless -e "$control/locals"
402 0 0 if (-e "$qdir/$file") { }
404 0 0 if (@now and $now[0] and $now[0] eq $value)
405 0 0 unless $value =~ /pass/
411 0 0 unless $value =~ /pass/
424 0 0 $r == 1 ? :
0 0 if ($r) { }
427 0 0 unless $value =~ /pass/
431 0 0 if (-e $manpath)
432 0 0 unless (`grep "$qdir/man" $manpath | grep -v grep`)
447 0 0 unless my $dbhost = $conf->{'vpopmail_mysql_repl_slave'}
449 0 0 unless my $dbport = $conf->{'vpopmail_mysql_repl_slave_port'}
451 0 0 unless my $dbname = $conf->{'vpopmail_mysql_database'}
453 0 0 unless my $dbuser = $conf->{'vpopmail_mysql_user'}
455 0 0 unless my $password = $conf->{'vpopmail_mysql_pass'}
482 2 0 if defined $p{'test_ok'}
494 0 0 $r == 1 ? :
0 0 if ($r) { }
502 0 0 if -l $shortcut
503 0 0 if (-e $shortcut) { }
506 0 0 unless symlink "$qmaildir/bin/qmailctl", $shortcut
511 0 0 unless symlink "$qmaildir/bin/qmailctl", $shortcut
516 0 0 if (-e "$qmaildir/rc") { }
522 0 0 if copy("$dir/run", "$qmaildir/rc")
528 0 0 if (-e "$confdir/rc.d/qmail.sh")
529 0 0 unless unlink "$confdir/rc.d/qmail.sh"
536 0 0 unless my $file = shift()
539 0 0 unless open my $FILE_HANDLE, '>', $file
694 2 0 if defined $p{'test_ok'}
696 0 0 unless -s $assign
705 0 0 if ($fields[0] ne '' and $fields[0] ne '.')
714 0 0 unless ($match)
716 0 0 if ($match eq 'dom' and $value eq "$fields[1]") { }
0 0 elsif ($match eq 'uid' and $value eq "$fields[2]") { }
0 0 elsif ($match eq 'dir' and $value eq "$fields[4]") { }
741 0 4 unless $key =~ /^rbl/
744 0 4 if $key =~ /^rbl_enable/
745 0 4 if $key =~ /^rbl_reverse_dns/
746 0 4 if $key =~ /^rbl_timeout/
747 1 3 if $key =~ /_message$/
748 1 2 if $self->conf->{$key} == 0
755 1 1 if ($self->conf->{$key} > 1) { }
773 0 4 unless my $good_rbls = $self->test_each_rbl('rbls', \@sorted)
780 0 2 if (defined $mess and $mess)
797 1 2 unless $key =~ /^rwl/ and $self->conf->{$key} == 1
798 0 2 if $key =~ /^rwl_enable/
820 0 0 unless (-d $quarantine)
821 0 0 if -d '/var/spool/qmailscan/quarantine'
825 0 0 unless -d "$quarantine/new"
829 0 0 if ($block)
833 0 0 unless $ipline
834 0 0 if $verbose
838 0 0 if $verbose
847 0 0 if $verbose
0 0 if ($ip =~ /\s+/ or not $ip) { }
849 0 0 if $verbose
851 0 0 if $verbose
853 0 0 if $clean
859 0 0 if scalar @sorted
866 1 10 unless (-d $dir)
869 11 0 if -d $dir
897 2 0 if defined $p{'test_ok'}
900 0 0 if ($self->conf->{'install_netqmail'})
904 0 0 unless (my $ver = $self->conf->{'install_qmail'})
924 0 0 if (-e $package)
925 0 0 unless ($self->util->source_warning('package', $package, 'src', $src))
931 0 0 if (not defined $self->conf->{'qmail_chk_usr_patch'}) { }
941 0 0 if ($self->conf->{'qmail_chk_usr_patch'})
947 0 0 if ($chkusr) { }
952 0 0 unless (-e "$package.tar.gz")
953 0 0 if (-e "/usr/ports/distfiles/$package.tar.gz") { }
960 0 0 unless (-e "$package.tar.gz")
966 0 0 unless (-e $patch)
968 0 0 unless (-e $patch)
973 0 0 unless ($tar and $patchbin)
976 0 0 unless chdir "$src/mail/$package"
980 0 0 unless $self->util->file_write('conf-qmail', 'lines', [$qmaildir])
983 0 0 unless $self->util->file_write('conf-vpopmail', 'lines', [$vpopdir])
986 0 0 unless $self->util->file_write('conf-mysql', 'lines', [$mysql])
991 0 0 if (-x $servicectl)
1003 0 0 unless (-f "$qmaildir/control/servercert.pem")
1007 0 0 if ($chkusr)
1018 0 0 unless (-e '/usr/share/skel/Maildir')
1026 0 0 if (-x $servicectl)
1038 2 0 if defined $p{'test_ok'}
1044 0 0 if (-e $run_f)
1049 0 0 if ($prot eq 'smtp') { }
0 0 elsif ($prot eq 'send') { }
0 0 elsif ($prot eq 'pop3') { }
0 0 elsif ($prot eq 'submit') { }
0 0 elsif ($prot eq 'qmail-deliverable') { }
0 0 elsif ($prot eq 'vpopmaild') { }
0 0 elsif ($prot eq 'qpsmtpd') { }
1076 2 0 if defined $p{'test_ok'}
1081 0 0 if ($Mail::Toaster::Qmail::OSNAME eq 'darwin')
1115 2 0 if defined $p{'test_ok'}
1120 0 0 unless ($destination)
1121 0 0 unless $prot
1123 0 0 unless my $dir = $self->toaster->supervise_dir_get($prot)
1128 0 0 unless -e $tmpfile
1131 0 0 -e $destination ? :
1156 0 2 if $self->conf->{'vpopmail_daemon'}
1162 2 0 if defined $p{'test_ok'}
1167 0 0 unless $valid_prots{$serv}
1182 0 0 $self->conf->{'supervise_rebuild_notice'} ? :
1184 0 0 if (-s $tmpfile)
1188 0 0 unless $self->util->install_if_changed('newfile', $tmpfile, 'existing', $run_f, 'mode', '0755', 'clean', 1, 'notify', $notify, 'email', $self->conf->{'toaster_admin_email'})
1221 0 0 unless (-d $skel)
1222 0 0 if -d '/etc/skel'
1225 0 0 if (not -e "$skel/Maildir")
1246 2 0 if defined $p{'test_ok'}
1251 0 0 unless $self->netqmail_rebuild
1255 0 0 unless $self->netqmail_get_sources($package)
1261 0 0 unless chdir "$src/mail/$package"
1266 0 0 unless chdir "$src/mail/$package/$package"
1278 0 0 if $self->conf->{'qmail_queue_extra'}
1279 0 0 if $Mail::Toaster::Qmail::OSNAME eq 'darwin'
1285 0 0 unless -x $servicectl
1286 0 0 if (-x $servicectl)
1301 0 0 if (-x $servicectl)
1310 0 0 unless $self->conf->{'vpopmail_qmail_ext'}
1317 0 0 if ($line =~ m[^/\* \#define CHKUSER_ENABLE_USERS_EXTENSIONS])
1336 0 0 if (-d '/opt/local/include/openssl') { }
0 0 elsif (-d '/usr/local/include/openssl' and $self->conf->{'install_openssl'}) { }
0 0 elsif (-d '/usr/include/openssl') { }
1351 0 0 if (-d '/usr/local/include/openssl') { }
1362 0 0 if ($domainkeys)
1364 0 0 unless (-e '/usr/local/include/domainkeys.h')
1367 0 0 if (-e '/usr/local/include/domainkeys.h')
1400 0 0 unless $self->util->file_write('conf-ld', 'lines', ['cc -Xlinker -x'])
1406 0 0 if ($line =~ m[#include <netinet/in.h>])
1415 0 0 if ($line =~ /struct strerr strerr_sys/)
1424 0 0 if ($line =~ /c\(auto_qmail,"doc","INSTALL",auto_uido,auto_gidq,0644\)/)
1440 0 0 unless my $package = shift()
1444 0 0 unless $self->util->source_warning('package', $package, 'src', "$src/mail")
1446 0 0 if -e "$package.tar.gz"
1450 0 0 if (-e $dist)
1453 0 0 if -e "$package.tar.gz"
1456 0 0 if -e "$package.tar.gz"
1468 0 0 if $patch_ver
1470 0 0 if (defined $self->conf->{'qmail_smtp_reject_patch'} and $self->conf->{'qmail_smtp_reject_patch'})
1474 0 0 if (defined $self->conf->{'qmail_domainkeys'} and $self->conf->{'qmail_domainkeys'})
1479 0 0 if ($sysname eq 'FreeBSD' and $version =~ /^(9|10)/)
1488 0 0 if -e $patch
1490 0 0 if -e $patch
1503 0 0 unless (-e "$ssl_lib/libcrypto.a")
1504 0 0 if (-e '/opt/local/lib/libcrypto.a') { }
0 0 elsif (-e '/usr/local/lib/libcrypto.a') { }
0 0 elsif (-e '/opt/lib/libcrypto.a') { }
0 0 elsif (-e '/usr/lib/libcrypto.a') { }
1513 0 0 if ($vpopdir ne '/home/vpopmail')
1514 0 0 if ($line =~ /^VPOPMAIL_HOME/)
1520 0 0 if ($line =~ m[tls.o ssl_timeoutio.o -L/usr/local/ssl/lib -lssl -lcrypto])
1528 0 0 if ($line =~ m[constmap.o tls.o ssl_timeoutio.o ndelay.a -L/usr/local/ssl/lib -lssl -lcrypto \\])
1562 0 0 if ($line =~ /#define QUEUE_EXTRA ""/)
1567 0 0 if ($line =~ /#define QUEUE_EXTRALEN 0/)
1573 0 0 if ($success == 2) { }
1587 0 0 unless -x "$qdir/bin/qmail-smtpd"
1590 0 0 unless `strings $qdir/bin/qmail-smtpd | grep vpopmail`
1604 0 0 unless (-d "$qmaildir/control")
1609 0 0 unless (-f "$qmaildir/control/servercert.pem")
1611 0 0 if (-f '/usr/local/openssl/certs/server.pem') { }
1620 0 0 if (not -f "$qmaildir/control/rsa512.pem")
1648 2 0 if (defined $p{'test_ok'})
1655 0 0 unless ($self->util->extract_archive("$package.tar.gz"))
1660 0 0 unless chdir "$src/mail/$package"
1663 0 0 unless chdir "$src/mail/$package/$package"
1667 0 0 if $Mail::Toaster::Qmail::OSNAME eq 'darwin'
1670 0 0 unless $self->util->file_write('conf-cc', 'lines', ['cc -O2'])
1674 0 0 if (-x $servicectl)
1686 0 0 if (-x $servicectl)
1699 0 1 unless ($base)
1706 1 0 unless ($queue and -d $queue)
1708 1 0 if $queue
1720 0 0 unless $self->conf->{'install_simscan'}
1725 0 0 unless -f $control
1726 0 0 if -e "$control.cdb" and not $self->util->file_is_newer('f1', $control, 'f2', "$control.cdb")
1729 0 0 unless -x $simscanmk
1731 0 0 unless `$simscanmk`
1745 0 0 if defined $p{'test_ok'}
1747 0 0 if (not -f $cert or -M $cert >= 1 or not -e $cert)
1755 0 0 if (not -f $cert or -M $cert >= 1 or not -e $cert)
1763 0 0 if (not -f $cert or -M $cert >= 1 or not -e $cert)
1776 0 0 if defined $p{'test_ok'}
1779 0 0 unless my $dir = $self->toaster->service_dir_get($prot)
1781 0 0 unless -d $dir or -l $dir
1792 0 0 if defined $p{'test_ok'}
1794 0 0 unless -d $qcontrol
1796 0 0 unless ($self->toaster->supervised_dir_test('send'))
1800 0 0 if $Mail::Toaster::Qmail::UID != 0
1812 0 0 if ($r =~ /^.*:\sup\s\(pid [0-9]*\)\s[0-9]*\sseconds$/)
1827 0 0 if defined $p{'test_ok'}
1834 0 0 unless $qcontrol
1837 0 0 unless $self->toaster->supervised_dir_test('send')
1840 0 0 if $Mail::Toaster::Qmail::UID != 0
1850 0 0 if ($r =~ /^.*:\sdown\s[0-9]*\sseconds/) { }
0 0 elsif ($r =~ /supervise not running/) { }
1863 0 0 if ($i > 100)
1876 0 0 if ($self->conf->{'simscan_debug'})
1888 0 0 unless $self->conf->{'smtpd_auth_enable'}
1895 0 0 if ($self->conf->{'smtpd_hostname'} and $self->conf->{'qmail_smtpd_auth_0.31'})
1900 0 0 unless my $chkpass = $self->_set_checkpasswd_bin('prot', 'smtpd')
1913 0 0 if ($self->conf->{'filtering_method'} ne 'smtp')
1921 0 0 if (defined $prot and $prot eq 'submit')
1926 0 0 unless (-x $queue)
1928 0 0 unless -x "$qdir/bin/qmail-queue"
1946 0 0 unless $self->conf->{'rwl_enable'} or $self->conf->{'rbl_enable'}
1956 0 0 $timeout != 60 ? :
1958 0 0 if $self->conf->{'rbl_enable_fail_closed'}
1959 0 0 unless $self->conf->{'rbl_enable_soft_failure'}
1961 0 0 if ($self->conf->{'rwl_enable'} and $self->conf->{'rwl_enable'} > 0) { }
1968 0 0 if ($self->conf->{'rbl_enable'} and $self->conf->{'rbl_enable'} > 0) { }
1970 0 0 if $list
1980 0 1 unless my $prot = shift()
1989 0 1 if ($prot_dir =~ m[^qmail_supervise/(.*)$])
2022 0 3 unless ($rbl)
2026 0 3 unless $self->dns->rbl_test('zone', $rbl)
2044 0 0 if ($relay =~ m[^vpopmail_home_dir/(.*)\.cdb$]) { }
2048 0 0 if ($relay =~ /^(.*)\.cdb$/)
2050 0 0 unless (-r $relay)
2060 0 0 if $verbose
2064 0 0 unless ($in)
2065 0 0 if ($line =~ /^### BEGIN QMAIL SCANNER VIRUS ENTRIES ###/)
2076 0 0 if ($line =~ /^### END QMAIL SCANNER VIRUS ENTRIES ###/)
2082 0 0 if ($in)
2084 0 0 unless ($timestamp)
2085 0 0 if $verbose
2088 0 0 if ($now > $timestamp) { }
2089 0 0 if $verbose
2092 0 0 if $verbose
2098 0 0 if ($done) { }
2099 0 0 if ($verbose)
2129 0 0 if ($Mail::Toaster::Qmail::OSNAME eq 'freebsd') { }
2141 0 0 if ($self->conf->{'install_mail_filtering'}) { }
2202 0 0 unless -d $self->conf->{'qmail_dir'}
2206 0 0 if $self->conf->{'install_vpopmail'} and not -d $self->conf->{'vpopmail_home_dir'}
2210 0 0 unless defined $qsuper and $qsuper
2214 0 0 unless -d $qsuper
2241 0 0 unless my $vdir = $self->conf->{'vpopmail_home_dir'}
2248 0 0 unless ($chkpass = $self->conf->{$prot_dir})
2256 0 0 if ($chkpass =~ m[^vpopmail_home_dir/(.*)$])
2261 0 0 unless -x $chkpass