On 2012-10-25 21:42 +0200, Mark Przepiora wrote:
> To anyone still dealing with this issue,
>
> I have patched the backup-manager-upload script to use Net::SFTP::Foreign
> instead of Net::FTP::Lite.
>
> Patch here: http://mark.przepiora.ca/public/backup-manager-upload.patch
Thanks, I'm attaching it to this mail so it does not get lost.
> This fixes the (highly annoying!) problem.
Unfortunately I don't use this particular feature of backup-manager so
I cannot test your patch. But maybe my esteemed co-maintainer (CC'ed)
can comment on it.
Cheers,
Sven
--- /usr/bin/backup-manager-upload.orig 2012-10-25 11:19:18.281633512 -0600
+++ /usr/bin/backup-manager-upload 2012-10-25 11:48:48.743356415 -0600
@@ -382,12 +382,7 @@
my ($fh, $filename) = get_tempfile('ftp-archives-XXXXXX');
my $BM_UPLOAD_FTP_SECURE = $ENV{"BM_UPLOAD_FTP_SECURE"};
my $ra_files;
- if ($BM_UPLOAD_FTP_SECURE eq "true") {
- $ra_files = $ftp->list();
- }
- else {
- $ra_files = $ftp->ls();
- }
+ $ra_files = $ftp->ls();
foreach my $file (@$ra_files) {
print $fh "$file\n";
}
@@ -448,22 +443,22 @@
return $ftp;
}
-sub ftptls_connect_to_host ($)
+sub ftptls_connect_to_host ($$$$)
{
- my ($host) = @_;
+ my ($host, $user, $passwd, $repository) = @_;
my $ftp;
- eval "use Net::Lite::FTP";
+ eval "use Net::SFTP::Foreign";
if ($@) {
- print_error "Net::Lite::FTP is not available, cannot use ftp secured
transfer mode";
+ print_error "Net::SFTP::Foreign is not available, cannot use ftp
secured transfer mode";
return undef;
}
eval {
- $ftp = Net::Lite::FTP->new ();
- $ftp->open ($host, "21");
+ $ftp = Net::SFTP::Foreign->new ($host, user => $user, password =>
$passwd);
+ # $ftp->open ($host, "21");
};
if ($@) {
- print_error "Unable to use the Net::Lite::FTP Perl module : $@";
+ print_error "Unable to use the Net::SFTP::Foreign Perl module : $@";
return undef;
}
return $ftp;
@@ -513,7 +508,7 @@
# The FTP over TLS transfer mode
if ($BM_UPLOAD_FTP_SECURE) {
- $ftp = ftptls_connect_to_host ($host);
+ $ftp = ftptls_connect_to_host ($host, $user, $passwd,
$repository);
unless (defined $ftp) {
print_error "Unable to connect to host: $host";
return FALSE;
@@ -565,7 +560,9 @@
}
}
print_info "All transfers done, loging out from $host\n";
- $ftp->quit;
+ if (! $BM_UPLOAD_FTP_SECURE) {
+ $ftp->quit;
+ }
}
return TRUE;
}
@@ -581,9 +578,7 @@
sub ftptls_login ($$$$)
{
my ($ftp, $user, $passwd, $repository) = @_;
- return ($ftp->user($user) and
- $ftp->pass($passwd) and
- $ftp->cwd($repository));
+ return ($ftp->setcwd($repository));
}
@@ -597,7 +592,7 @@
{
my ($ftp, $file) = @_;
my $basename = basename ($file);
- return $ftp->put ($basename, $file);
+ return $ftp->put ($file, $basename);
}
# }}}