Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/DCC.pm
Criterion Covered Total %
branch 53 286 18.5


line true false branch
95 20 0 if (eval {
0 0 elsif (eval {
0 0 elsif (eval {
113 60 1 if ($mailsaobject->{'local_tests_only'}) { }
233 0 0 if (not defined $value or $value eq "")
237 0 0 stat $value ? :
238 0 0 if ($stat_errn != 0 or not -d _)
239 0 0 !-d(_) ? :
0 0 $stat_errn == 2 ? :
271 0 0 if (not defined $value or $value eq "")
276 0 0 if ($value =~ /^ (?: \[ ([^\]]*) \] | ([^:]*) ) : ([^:]*) \z/sx) { }
277 0 0 defined $1 ? :
279 0 0 unless ($host)
283 0 0 if (not $port && $port =~ /^\d+\z/ or $port < 1 or $port > 65535)
294 0 0 unless ($value =~ m[^/])
330 0 0 if (not defined $value or $value eq "")
334 0 0 unless (-x $value)
359 0 0 unless ($value =~ m[^([0-9A-Za-z ,._/-]+)$])
384 0 0 unless ($value =~ m[^([0-9A-Za-z ,._/-]+)$])
418 3 0 unless (stat $dir)
420 3 0 if ($dir_errno == 2) { }
427 0 0 unless (-d _)
440 3 1 if defined $self->{'dcc_version'}
451 0 1 if ($cdcc and open CDCC, "$cdcc $cmd 2>&1 |")
457 0 0 $cdcc_output =~ /^(\d+\.\d+\.\d+)/ ? :
458 0 0 $cdcc_output =~ /\s+homedir=(\S+)/ ? :
459 0 0 if ($cdcc_output =~ /\s+libexecdir=(\S+)/)
465 0 1 if (not $conf->{'dcc_home'} and $cdcc_home)
469 1 0 unless ($conf->{'dcc_home'})
474 1 0 unless ($conf->{'dcc_libexec'})
477 1 0 unless ($conf->{'dcc_libexec'})
483 0 1 if ($self->{'dcc_version'} =~ /\d+\.(\d+)\.(\d+)$/ and $1 < 3 || $1 == 3 && $2 < 123) { }
485 0 0 if ($1 < 3 or $1 == 3 and $2 < 50)
505 0 2 if (defined $pgmpath and $pgmpath ne "")
507 0 0 if $pgm eq "dccproc"
509 0 0 if ($pgmpath =~ s[[^/]+\z][$pgm]s)
511 0 0 if (-x $pgmpath)
519 0 2 if (defined $pgmpath)
525 1 1 !defined($conf->{'dcc_home'}) ? :
528 2 7 unless defined $dir
530 0 7 if (-x $pgmpath)
544 0 4 if $self->{'dccifd_available'}
547 0 4 if (defined $conf->{'dcc_dccifd_host'})
556 1 3 unless ($sockpath)
557 0 1 if ($conf->{'dcc_dccifd_path_raw'}) { }
566 0 0 if -S $sockpath and -w _ and -r _
577 3 1 if defined $self->{'dccproc_available'}
580 1 0 if (not defined $dccproc or $dccproc eq "")
583 1 0 unless ($dccproc and -x $dccproc)
599 0 0 if (defined $sockpath) { }
602 0 0 unless $sock
611 0 0 unless $sock
615 0 0 unless $sock
624 0 4 unless ($conf->{'use_dcc'})
630 4 0 unless ($self->is_dccifd_available or $self->is_dccproc_available)
643 0 4 unless ($self->{'main'}{'conf'}{'use_dcc'})
653 0 4 if ($$fulltext eq "")
658 0 4 if ($permsgstatus->get("ALL") =~ /^(X-DCC-.*-Metrics:.*)$/m)
664 0 0 if $permsgstatus->{'dcc_raw_x_dcc'} =~ / bulk /
670 0 4 if $self->{'dcc_disabled'}
682 4 0 unless $permsgstatus->{'dcc_checked'}
685 4 0 if not defined $x_dcc or $x_dcc eq ""
687 0 0 if ($x_dcc =~ /^X-DCC-(.*)-Metrics: (.*)$/)
695 0 0 if ($x_dcc =~ /\bBody=(\d+)/)
698 0 0 if ($x_dcc =~ /\bFuz1=(\d+)/)
701 0 0 if ($x_dcc =~ /\bFuz2=(\d+)/)
704 0 0 if ($x_dcc =~ /\brep=(\d+)/)
707 0 0 if ($count{'body'} >= $conf->{'dcc_body_max'} or $count{'fuz1'} >= $conf->{'dcc_fuz1_max'} or $count{'fuz2'} >= $conf->{'dcc_fuz2_max'} or $count{'rep'} >= $conf->{'dcc_rep_percent'})
713 0 0 defined $_ ? :
729 0 0 unless (defined $dcc_rep)
730 0 0 unless $permsgstatus->{'dcc_checked'}
732 0 0 if (defined $x_dcc and $x_dcc =~ /\brep=(\d+)/) { }
743 0 0 if $dcc_rep < 0
746 0 0 unless defined $min
747 0 0 unless defined $max
749 0 0 $dcc_rep >= $min && $dcc_rep <= $max ? :
750 0 0 $result ? :
795 0 4 if ($self->{'dccifd_available'})
799 0 0 unless ($sock)
801 0 0 unless $self->is_dccproc_available
809 0 4 if ($self->{'dccifd_available'}) { }
814 0 0 if (not defined $client) { }
817 0 0 if defined $clientname
820 0 0 if ($tag ne 'dcc:') { }
824 0 0 if (defined $permsgstatus->{'dcc_raw_x_dcc'})
830 0 0 unless $sock->print($opts)
831 0 0 unless $sock->print($client . "\n")
832 0 0 unless $sock->print($helo . "\n")
833 0 0 unless $sock->print("\n")
834 0 0 unless $sock->print("unknown\n\n")
835 0 0 unless $sock->print($$fulltext)
836 0 0 unless $sock->shutdown(1)
838 0 0 unless $sock->getline
839 0 0 unless $sock->getline
842 0 0 if not @resp
853 4 0 !defined($opts) ? :
857 0 4 if ($client) { }
863 4 0 if ($tag eq 'dcc:') { }
865 0 4 if defined $permsgstatus->{'dcc_raw_x_dcc'}
870 4 0 if ($conf->{'dcc_home'})
875 4 0 unless defined $path
881 0 0 unless $pid
886 0 0 unless defined $nread
889 0 0 unless close DCC
890 0 0 unless proc_status_ok($?, $errno)
893 0 0 if not @resp
897 4 0 if (defined $pgm and $pgm eq "dccproc")
898 0 4 if (defined fileno DCC)
899 0 0 if ($pid)
900 0 0 if (kill 'TERM', $pid) { }
906 0 0 unless close DCC
907 0 0 unless proc_status_ok($?, $errno)
914 0 4 if ($timer->timed_out)
919 4 0 if ($err)
926 0 0 unless (defined $raw_x_dcc and $raw_x_dcc =~ /^X-DCC/)
939 41 40 if $self->{'learn_disabled'}
941 0 40 unless ($conf->{'use_dcc'})
946 40 0 if (not defined $learn_score or $learn_score eq "")
955 0 0 if ($permsgstatus->is_spam)
958 0 0 if ($score < $required_score + $learn_score)
966 0 0 unless defined $permsgstatus->{'dcc_raw_x_dcc'}
969 0 0 unless ($permsgstatus->{'dcc_raw_x_dcc'} =~ /\b(Body|Fuz1|Fuz2)=\d/)
977 0 0 if $old_cksums and $self->dccsight_learn($permsgstatus, $old_cksums)
986 0 0 if defined $raw_x_dcc
993 0 0 unless $old_cksums
996 0 0 unless ($dccsight)
997 0 0 if $dccsight eq ""
1020 0 0 unless $pid
1025 0 0 unless defined $nread
1028 0 0 unless close DCC
1029 0 0 unless proc_status_ok($?, $errno)
1032 0 0 unless @resp
1037 0 0 if (defined fileno DCC)
1038 0 0 if ($pid)
1039 0 0 if (kill 'TERM', $pid) { }
1044 0 0 unless close DCC
1045 0 0 unless proc_status_ok($?, $errno)
1051 0 0 if ($timer->timed_out)
1056 0 0 if ($err)
1062 0 0 if ($raw_x_dcc)
1073 0 0 if $options->{'report'}{'options'}{'dont_report_to_dcc'}
1075 0 0 if $self->{'dcc_disabled'}
1083 0 0 if (defined $raw_x_dcc) { }