VirusScan/Engine/Command/Sophos/Savscan.pm

filter: Statementstmt 54.5% 24 / 44 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 88.8% 8 / 9 Podpod 50.0% 1 / 2 totaltotal 44.0% 33 / 75 CC 9 SCAR 38.7
CC
9
Cov
39%
scan
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 48.1
« VirusScan/Engine/Daemon/Symantec/CSS.pm ↑ Summary VirusScan/Engine/Command/Sophos/Sweep.pm »
1 package File::VirusScan::Engine::Command::Sophos::Savscan;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use File::VirusScan::Engine::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use vars qw( @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 @ISA = qw( File::VirusScan::Engine::Command );
9  
10 1 ▶use Cwd 'abs_path';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use File::VirusScan::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub default_arguments
15 5 ▶{
Subroutine default_arguments: called CC=1 SCAR=0.0
Pod undocumented
16 5 return [qw( -f -mime -all -cab -oe -tnef -archive -ss)];
17 }
18  
19 sub scan
20 0 ▶{
Subroutine scan: not called CC=9 SCAR=45.0
Pod documented
21 0 my ($self, $path) = @_;
22  
23 0 my $abs = abs_path($path);
24 0 ▶ if ($abs && $abs ne $path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($abs and $abs ne $path) 0 0 0
Condition0%0/3
$abs and $abs ne $path
!ll&&!rl&&r
000
MC/DC0%0/2
$abs and $abs ne $path
$abs $abs ne $path
Truth table0%0/3
A and B
A= $absB= $abs ne $path
ABresult
0X0
100
111
25 0 $path = $abs;
26 }
27  
28 0 my ($exitcode, $scan_response) = eval { $self->_run_commandline_scanner(join(' ', $self->{command}, @{ $self->{args} }, $path, '2>&1'), qr/(?:>>> Virus)|(?:Password)|(?:Could not check)/,); };
29  
30 0 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
31 0 return File::VirusScan::Result->error($@);
32 }
33  
34 0 ▶ if(0 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 == $exitcode) 0 0 0
35 0 return File::VirusScan::Result->clean();
36 }
37  
38 0 ▶ if(1 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 == $exitcode) 0 0 0
39 0 return File::VirusScan::Result->error('Virus scan interrupted');
40 }
41  
42 0 ▶ if(2 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 == $exitcode) 0 0 0
43  
44 # This is technically an error code, but Sophos chokes
45 # on a lot of M$ docs with this code, so we let it
46 # through...
47 # TODO: Legacy commment from MIMEDefang. Figure this
48 # out and see if this is sane behaviour.
49 0 return File::VirusScan::Result->clean();
50 }
51  
52 0 ▶ if(3 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (3 == $exitcode) 0 0 0
53 0 my ($virus_name) = $scan_response =~ m/\s*>>> Virus '(\S+)'/;
54 0 ▶ $virus_name ||= 'unknown-Savscan-virus';
Condition0%0/2
$virus_name ||= "unknown-Savscan-virus"
l!l
00
MC/DC0%0/1
$virus_name ||= "unknown-Savscan-virus"
$virus_name
Truth table0%0/2
A
A= $virus_name
Aresult
11
00
55 0 return File::VirusScan::Result->virus($virus_name);
56 }
57  
58 0 return File::VirusScan::Result->error("Unknown return code from savscan: $exitcode");
59 }
60  
61 1 1;
62 __END__
« VirusScan/Engine/Daemon/Symantec/CSS.pm ↑ Summary VirusScan/Engine/Command/Sophos/Sweep.pm »