diff options
author | Mark Wells <mark@freeside.biz> | 2014-06-26 15:47:22 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-06-26 16:04:51 -0700 |
commit | fa978560e3b0473728ebf2fb32625765465c230a (patch) | |
tree | 07f90f1a1980f0f1fee00ad736a4b1adb5ca723e /FS/FS/upload_target.pm | |
parent | 3e3441036353ea99dc85548bbdbe810edc81b181 (diff) |
NENA2 E911 export and batch-oriented exports in general, #14049
Diffstat (limited to 'FS/FS/upload_target.pm')
-rw-r--r-- | FS/FS/upload_target.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/FS/FS/upload_target.pm b/FS/FS/upload_target.pm index f3486d3..33088cb 100644 --- a/FS/FS/upload_target.pm +++ b/FS/FS/upload_target.pm @@ -153,7 +153,8 @@ sub put { local $@; my $connection = eval { $self->connect }; return $@ if $@; - $connection->put($localname, $remotename) or return $connection->error; + $connection->put($localname, $remotename); + return $connection->error || ''; } elsif ( $self->protocol eq 'email' ) { my $to = join('@', $self->username, $self->hostname); @@ -199,13 +200,15 @@ sub connect { eval "use Net::SFTP::Foreign;"; die $@ if $@; my %args = ( - port => $self->port, user => $self->username, - password => $self->password, - more => ($DEBUG ? '-v' : ''), timeout => 30, - autodie => 1, #we're doing this anyway + autodie => 0, #we're doing this anyway ); + # Net::SFTP::Foreign does not deal well with args that are defined + # but empty + $args{port} = $self->port if $self->port and $self->port != 22; + $args{password} = $self->password if length($self->password) > 0; + $args{more} = '-v' if $DEBUG; my $sftp = Net::SFTP::Foreign->new($self->hostname, %args); $sftp->setcwd($self->path); return $sftp; |