Fix #5388
This commit is contained in:
parent
b40fc2590e
commit
6cbb625ff0
|
@ -172,7 +172,7 @@ Need Perl 'Net::FTPSSL' module
|
||||||
=item B<--ftp-options>
|
=item B<--ftp-options>
|
||||||
|
|
||||||
Add custom ftp options.
|
Add custom ftp options.
|
||||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||||
|
|
||||||
=item B<--username>
|
=item B<--username>
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,11 @@ sub run {
|
||||||
|
|
||||||
apps::protocols::ftp::lib::ftp::connect($self);
|
apps::protocols::ftp::lib::ftp::connect($self);
|
||||||
my $current_time = time();
|
my $current_time = time();
|
||||||
foreach my $dir (@{$self->{option_results}->{directory}}) {
|
my $dirs = ['.'];
|
||||||
|
if (defined($self->{option_results}->{directory}) && scalar(@{$self->{option_results}->{directory}}) != 0) {
|
||||||
|
$dirs = $self->{option_results}->{directory};
|
||||||
|
}
|
||||||
|
foreach my $dir (@$dirs) {
|
||||||
my @files;
|
my @files;
|
||||||
|
|
||||||
if (!(@files = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{ls}->{$self->{ssl_or_not}}->{name}, command_args => [$dir]))) {
|
if (!(@files = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{ls}->{$self->{ssl_or_not}}->{name}, command_args => [$dir]))) {
|
||||||
|
@ -113,7 +117,7 @@ sub run {
|
||||||
my $time_result;
|
my $time_result;
|
||||||
|
|
||||||
if (!($time_result = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name}, command_args => [$file]))) {
|
if (!($time_result = apps::protocols::ftp::lib::ftp::execute($self, command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name}, command_args => [$file]))) {
|
||||||
# Surely a directory. So we go forward. Can't get time for that.
|
# Sometime we can't have mtime for a directory
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +188,7 @@ Need Perl 'Net::FTPSSL' module
|
||||||
=item B<--ftp-options>
|
=item B<--ftp-options>
|
||||||
|
|
||||||
Add custom ftp options.
|
Add custom ftp options.
|
||||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||||
|
|
||||||
=item B<--username>
|
=item B<--username>
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,7 @@ use File::Basename;
|
||||||
|
|
||||||
# How much arguments i need and commands manages
|
# How much arguments i need and commands manages
|
||||||
my %map_commands = (
|
my %map_commands = (
|
||||||
mdtm => { ssl => { name => '_mdtm' }, nossl => { name => 'mdtm' } },
|
ls => { ssl => { name => 'list' }, nossl => { name => 'dir'} },
|
||||||
ls => { ssl => { name => 'nlst' }, nossl => { name => 'ls'} },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -144,8 +143,12 @@ sub countFiles {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $file (@files) {
|
foreach my $line (@files) {
|
||||||
my $name = $dir . '/' . basename($file);
|
next if ($line !~ /(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(.*)/);
|
||||||
|
my ($rights, $filename) = ($1, $2);
|
||||||
|
my $bname = basename($filename);
|
||||||
|
next if ($bname eq '.' || $bname eq '..');
|
||||||
|
my $name = $dir . '/' . $bname;
|
||||||
|
|
||||||
if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
if (defined($self->{option_results}->{filter_file}) && $self->{option_results}->{filter_file} ne '' &&
|
||||||
$name !~ /$self->{option_results}->{filter_file}/) {
|
$name !~ /$self->{option_results}->{filter_file}/) {
|
||||||
|
@ -153,9 +156,7 @@ sub countFiles {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(my $time_result = apps::protocols::ftp::lib::ftp::execute($self,
|
if ($rights =~ /^d/i) {
|
||||||
command => $map_commands{mdtm}->{$self->{ssl_or_not}}->{name},
|
|
||||||
command_args => [$name]))) {
|
|
||||||
if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) {
|
if (defined($self->{option_results}->{max_depth}) && $level + 1 <= $self->{option_results}->{max_depth}) {
|
||||||
push @$list, { name => $name, level => $level + 1};
|
push @$list, { name => $name, level => $level + 1};
|
||||||
}
|
}
|
||||||
|
@ -163,7 +164,7 @@ sub countFiles {
|
||||||
$self->{output}->output_add(long_msg => sprintf("Match '%s'", $name));
|
$self->{output}->output_add(long_msg => sprintf("Match '%s'", $name));
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $count;
|
return $count;
|
||||||
|
@ -195,7 +196,7 @@ Need Perl 'Net::FTPSSL' module
|
||||||
=item B<--ftp-options>
|
=item B<--ftp-options>
|
||||||
|
|
||||||
Add custom ftp options.
|
Add custom ftp options.
|
||||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||||
|
|
||||||
=item B<--username>
|
=item B<--username>
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ Need Perl 'Net::FTPSSL' module
|
||||||
=item B<--ftp-options>
|
=item B<--ftp-options>
|
||||||
|
|
||||||
Add custom ftp options.
|
Add custom ftp options.
|
||||||
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1"
|
Example: --ftp-options='Debug=1" --ftp-options='useSSL=1'
|
||||||
|
|
||||||
=item B<--username>
|
=item B<--username>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue