Branch Coverage

blib/lib/Net/SFTP/SftpServer.pm
Criterion Covered Total %
branch 7 392 1.7


line true false branch
268 0 1 if (ref $_[0] eq 'HASH')
283 0 1 $ESCALATE_DEBUG ? :
314 0 0 if ($$req{'handle'})
319 0 0 if (defined $arg{'response'} and $arg{'response'}->getType == 101)
325 0 0 if ($$req{'id'})
329 0 0 if ($$req{'name'})
334 0 0 if (defined $$req{$field})
339 0 0 if ($$req{'attr'})
355 0 0 if ($$self{'log_action_supress'}{$$req{'message_type'}}) { }
369 0 0 if ($response->getType == 101 and $$self{'log_all_status'} || $response->getStatus != 0 && $response->getStatus != 1) { }
0 0 elsif ($response->getType == 103 or $$req{'message_type'} == 6) { }
391 0 1 if (defined $arg{'debug'})
395 0 1 if (defined $arg{'file_perms'})
396 0 1 if (defined $arg{'dir_perms'})
401 1 0 unless (-d $$self{'home_dir'})
405 0 0 unless (-O $$self{'home_dir'})
410 0 0 if (defined $arg{'on_file_sent'})
413 0 0 if (defined $arg{'on_file_received'})
416 0 0 if (defined $arg{'move_on_sent'})
419 0 0 if (defined $arg{'move_on_received'})
423 0 0 defined $arg{'use_tmp_upload'} && $arg{'use_tmp_upload'} ? :
425 0 0 defined $arg{'max_file_size'} ? :
427 0 0 defined $arg{'valid_filename_char'} && ref $arg{'valid_filename_char'} eq 'ARRAY' ? :
430 0 0 if (defined $arg{'deny'} and $arg{'deny'} == 1000 or defined $arg{'allow'} and $arg{'allow'} != 1000 and not defined $arg{'deny'})
436 0 0 ref $arg{'deny'} eq 'ARRAY' ? :
0 0 !defined($arg{'deny'}) ? :
438 0 0 ref $arg{'allow'} eq 'ARRAY' ? :
0 0 !defined($arg{'allow'}) ? :
455 0 0 if ($$self{'no_symlinks'})
461 0 0 ref $arg{'fake_ok'} eq 'ARRAY' ? :
0 0 !defined($arg{'fake_ok'}) ? :
486 0 0 defined $arg{'log_all_status'} ? :
498 0 0 if ($packet_length > 1048576)
510 0 0 if ($@)
531 0 0 if ($read_len == 0) { }
0 0 elsif ($read_len < 0) { }
567 0 0 if ($write_len < 0)
580 0 0 if (defined $$self{'handles'}{$handle_no} and $type eq '' || $type eq $$self{'handles'}{$handle_no}->getType)
593 0 0 if (defined $$self{'handles'}{$handle_no})
604 0 0 if ($$self{'open_handle_count'} > 512)
622 0 0 if ($$req{'message_type'} != 1)
632 0 0 if (defined {1 => 'processInit', 10 => 'processFsetstat', 11 => 'processOpendir', 12 => 'processReaddir', 13 => 'processRemove', 14 => 'processMkdir', 15 => 'processRmdir', 16 => 'processRealpath', 17 => 'processStat', 18 => 'processRename', 19 => 'processReadlink', 20 => 'processSymlink', 200 => 'processExtended', 3 => 'processOpen', 4 => 'processClose', 5 => 'processRead', 6 => 'processWrite', 7 => 'processLstat', 8 => 'processFstat', 9 => 'processSetstat'}->{$$req{'message_type'}}) { }
640 0 0 unless $payload->done
654 0 0 if ($type == 101) { }
0 0 elsif ($type == 102) { }
0 0 elsif ($type == 103) { }
0 0 elsif ($type == 2) { }
0 0 elsif ($type == 105) { }
0 0 elsif ($type == 104) { }
657 0 0 if ($$self{'client_version'} >= 3)
687 0 0 if ($$self{'client_version'} >= 3)
718 0 0 $$req{'attr'}{'flags'} & 4 ? :
0 0 defined $$self{'file_perms'} ? :
723 0 0 if $self->denyOperation(3, $response)
727 0 0 if (not defined $filename or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($filename))
737 0 0 $$self{'use_tmp_upload'} && $$req{'pflags'} & 8 && $$req{'pflags'} & 2 && ($$req{'pflags'} & 16 || $$self{'FS'}->ZeroSize($filename)) ? :
743 0 0 if (not defined $fd) { }
747 0 0 if (defined $handle) { }
771 0 0 if (defined $fd) { }
773 0 0 $ret ? :
774 0 0 if ($fd->getType eq 'file')
777 0 0 if (defined $$self{'move_on_sent'} and $fd->wasSent) { }
0 0 elsif (defined $$self{'move_on_received'} and $fd->wasReceived) { }
783 0 0 if (defined $$self{'on_file_sent'} and $fd->wasSent) { }
0 0 elsif (defined $$self{'on_file_received'} and $fd->wasReceived) { }
786 0 0 if ($@)
793 0 0 if ($@)
819 0 0 if $self->denyOperation(5, $response)
822 0 0 if (defined $fd) { }
823 0 0 if ($fd->sysseek($$req{'off'}, 0) < 0) { }
830 0 0 if ($ret < 0) { }
0 0 elsif ($ret == 0) { }
837 0 0 if $fd->getReadBytes eq $$req{'off'}
859 0 0 if $self->denyOperation(6, $response)
863 0 0 if (defined $fd)
864 0 0 if ($$self{'max_file_size'} and $$req{'off'} + length($$req{'data'}) > $$self{'max_file_size'}) { }
0 0 elsif ($$self{'max_file_size'} and $$req{'off'} + length($$req{'data'}) > 0.75 * $$self{'max_file_size'}) { }
872 0 0 if ($fd->sysseek($$req{'off'}, 0) < 0) { }
879 0 0 if ($ret < 0) { }
0 0 elsif ($ret == $len) { }
884 0 0 if $fd->getWrittenBytes eq $$req{'off'}
907 0 0 $mode ? :
0 0 if $self->denyOperation($mode ? 7 : 17, $response)
909 0 0 if (not defined $filename or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($filename))
913 0 0 $mode ? :
914 0 0 if (scalar @st == 0) { }
949 0 0 if $self->denyOperation(8, $response)
952 0 0 if (defined $fd) { }
954 0 0 if (scalar @st == 0) { }
981 0 0 if (not defined $filename or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($filename))
986 0 0 if $self->denyOperation(9, $response)
1005 0 0 if $self->denyOperation(10, $response)
1023 0 0 if $self->denyOperation(11, $response)
1025 0 0 if (not defined $pathname or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($pathname))
1031 0 0 if (not defined $dirp) { }
1035 0 0 if (defined $handle) { }
1055 0 0 if $self->denyOperation(12, $response)
1058 0 0 if (not defined $dirp) { }
1067 0 0 if $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($pathname)
1069 0 0 unless scalar @st
1078 0 0 if $count == 100
1080 0 0 if ($count > 0) { }
1104 0 0 if $self->denyOperation(13, $response)
1106 0 0 if (not defined $filename or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($filename))
1112 0 0 $ret ? :
1113 0 0 if ($status == 0)
1132 0 0 $$req{'attr'}{'flags'} & 4 ? :
0 0 defined $$self{'dir_perms'} ? :
1137 0 0 if $self->denyOperation(14, $response)
1139 0 0 unless (defined $filename)
1145 0 0 $ret ? :
1161 0 0 if $self->denyOperation(15, $response)
1163 0 0 unless (defined $filename)
1169 0 0 $ret ? :
1207 0 0 if $self->denyOperation(18, $response)
1209 0 0 if (not defined $oldpath && defined $newpath or $$self{'no_symlinks'} and $$self{'FS'}->IsSymlink($oldpath))
1214 0 0 if $$self{'FS'}->IsDir($oldpath) and $self->denyOperation(1001, $response)
1216 0 0 if ($$self{'FS'}->IsFile($oldpath)) { }
0 0 elsif ($$self{'FS'}->IsDir($oldpath)) { }
1218 0 0 if (not $$self{'FS'}->Link($oldpath, $newpath)) { }
0 0 elsif (not $$self{'FS'}->Unlink($oldpath)) { }
1220 0 0 if (not $$self{'FS'}->Rename($oldpath, $newpath)) { }
1237 0 0 if (not $$self{'FS'}->Rename($oldpath, $newpath)) { }
1279 0 0 if $self->denyOperation(20, $response)
1301 0 0 if (defined $$self{'deny'}{$op} and $$self{'deny'}{$op})
1303 0 0 if (defined $$self{'fake_ok'}{$op} and $$self{'fake_ok'}{$op}) { }
1324 0 0 if (scalar @ltime)
1325 0 0 if (time - $$st[9] < 15768000) { }
1333 0 0 length $user > 8 ? :
1334 0 0 length $group > 8 ? :
1350 0 0 if ($d eq '..') { }
0 0 elsif ($d ne '.') { }
1354 0 0 if ($$self{'valid_filename_char'})
1355 0 0 unless ($d =~ /^[$$self{'valid_filename_char'}]*$/)
1362 0 0 if ($$self{'no_symlinks'})
1363 0 0 if ($$self{'FS'}->IsSymlink(join('/', @newpath)))
1379 0 0 if ($$attr{'flags'} & 1)
1384 0 0 if ($$attr{'flags'} & 2)
1388 0 0 if ($$attr{'flags'} & 4)
1391 0 0 if ($$attr{'flags'} & 8)
1423 0 0 if ($pflags & 1 and $pflags & 2) { }
0 0 elsif ($pflags & 1) { }
0 0 elsif ($pflags & 2) { }
1433 0 0 if ($pflags & 8)
1436 0 0 if ($pflags & 16)
1439 0 0 if ($pflags & 32)
1449 0 0 if ($errno == 0) { }
0 0 elsif ($errno == 2 or $errno == 20 or $errno == 9 or $errno == 40) { }
0 0 elsif ($errno == 1 or $errno == 13 or $errno == 14) { }
0 0 elsif ($errno == 36 or $errno == 22) { }
1506 0 0 if ($key eq 'data' and not $$self{'_decoded_data'}{'data'} =~ /^[\s\w]*$/) { }
1521 0 0 if ($type eq 'int') { }
0 0 elsif ($type eq 'int64') { }
0 0 elsif ($type eq 'char') { }
0 0 elsif ($type eq 'string') { }
0 0 elsif ($type eq 'attrib') { }
1578 0 0 if ($$attr{'flags'} & 1)
1581 0 0 if ($$attr{'flags'} & 2)
1585 0 0 if ($$attr{'flags'} & 4)
1588 0 0 if ($$attr{'flags'} & 8)
1594 0 0 if ($$attr{'flags'} & 2147483648)
1607 0 0 if length $$self{'data'} eq 0
1663 0 0 if ($key eq 'data' and not $$self{'data'} =~ /^[\s\w]*$/) { }
1731 0 0 unless ref $$self{'names'} eq 'ARRAY'
1790 0 1 unless $self->initialise(@_)
1915 0 0 if $1
1958 0 0 if ($use_tmp)
1964 0 0 unless defined $fd
1991 0 0 unless ($ret)
1995 0 0 if ($use_temp_of{$ident})
2053 0 0 if ($write_of{$ident} and $read_of{$ident}) { }
0 0 elsif ($write_of{$ident}) { }
0 0 elsif ($read_of{$ident}) { }
2077 0 0 if ($write_of{$ident} and not $read_of{$ident} and $self->Size($filename_of{$ident}) eq $write_of{$ident})
2086 0 0 if ($read_of{$ident} and not $write_of{$ident} and $self->Size($filename_of{$ident}) eq $read_of{$ident})
2118 0 0 unless ($self->callback)
2123 0 0 if ($state_of{$ident} ne 'open')
2133 0 0 unless ($self->callback)
2138 0 0 if ($state_of{$ident} ne 'open')
2151 0 0 if ($arg{'BREAKCHROOT'})
2158 0 0 unless ($self->Exists($filename_of{$ident}))
2164 0 0 if ($filename_of{$ident} =~ m[/$arg{'dst'}/])
2169 0 0 if ($arg{'filename_condition'})
2170 0 0 unless $filename_of{$ident} =~ /$arg{'filename_condition'}/
2174 0 0 if (not $self->Exists("$dir/processed")) { }
0 0 elsif (not $self->IsDir("$dir/processed")) { }
2175 0 0 unless ($self->Mkdir("$dir/processed", $arg{'dir_perms'}))
2186 0 0 if ($self->Exists("$dir/processed/$name"))
2191 0 0 unless ($self->Rename($filename_of{$ident}, "$dir/processed/$name"))
2207 0 0 unless (-d $arg{'dst'} and -w $arg{'dst'})
2212 0 0 unless ($self->Exists($filename_of{$ident}))
2217 0 0 if ($arg{'filename_condition'})
2218 0 0 unless $filename_of{$ident} =~ /$arg{'filename_condition'}/
2258 0 0 if defined $fh_of{$ident} and $fh_of{$ident}->opened
2300 0 0 unless defined $fd
2323 0 0 unless ($ret)