Re: [Ssh-sftp-perl-users] Getting SETSTAT failures from sftp-put SOLVED
Brought to you by:
dbrobins
|
From: Salvador F. <sfa...@ya...> - 2010-07-21 16:47:42
|
----- Original Message ----
> From: Bob Gammage <sta...@ga...>
> To: ssh...@li...
> Cc: Salvador Fandino <sfa...@ya...>
> Sent: Wed, July 21, 2010 4:41:56 PM
> Subject: Re: [Ssh-sftp-perl-users] Getting SETSTAT failures from sftp-put
>SOLVED
>
> Salva,
> Everything I'd previously read suggested using Compat so the local
>implementation of OpenSSH would be used instead of the perl-implementation.
>The logic being that OpenSSH is more rigorously kept patched with security
>updates.
it seems you are confused!
There are mainly two Perl modules implementing the SFTP protocol: Net::SFTP that
runs on top of Net::SSH::Perl and Net::SFTP::Foreign that uses a binary SSH
client to establish the SSH connection to the server.
Net::SFTP::Foreign::Compact is a thin adapter layer on top of Net::SFTP::Foreign
implementing (most of) the API of Net::SFTP, so that programs written for this
module can be easily be changed to use Net::SFTP::Foreign.
... well, actually, there is a third module implementing SFTP in Perl,
Net::SSH2::SFTP, distributed as part of Net::SSH2, but it is not very powerful
yet, lacking some indispensable features as "put" and "get" methods.
- Salva
> Your suggested change to the 'new' and 'put' arguments does indeed seem to
>work on the new host and seems to work just fine with all the others as well.
>
> Thank you very very much.
> -- Bob
> Si vis pacem, para bellum
>
> Salva wrote:
> > You will have to switch to the real thing and use Net::SFTP::Foreign in
>order to solve your problem:
> >
> > $sftp = Net::SFTP::Foreign->new($RHNAME, user => $RHUSER, port =>
>$RHPORT);
> > $sftp->put($SAF, $DAF, copy_perms => 0, copy_time => 0);
> >
> > Cheers,
> > - Salva >
> >
> >
> > ----- Original Message ----
> >> From: Bob To: ssh...@li...
> >> Sent: Wed, July 21, 2010 2:20:54 PM
> >> Subject: [Ssh-sftp-perl-users] Getting SETSTAT failures from sftp-put
> >>
> >> Dear perl-gods,
> >> I have a daemon, written in perl, that SFTP's files to target hosts
> >> based upon an INI file of local-directories to watch, and target-hosts.
> >> It has been working fine for some time.
> >>
> >> I am using Perl v5.8.8, Net::SFTP::Foreign v1.51 & ::Compat v1.36
> >>
> >> The relevant code is:
> >> %LIBARGS=('user'+>$RHUSER,'port'=>$RHPORT,'late_setperm'=>1);
> >> $SLC = Net::SFTP::Foreign::Compat->new($RHNAME, %LIBARGS);
> >> my $FXSTAT = $SLC->put($SAF, $DAF);
> >>
> >> A new host to which I must now send things is a relatively new SFTP
> >> implementation and has internal processes that move files as soon as
> >> received. I suspect this is the reason I am getting an error:
> >> "Couldn't setstat remote file (setstat)': Specified file path is invalid"
> >> ...even though the file was received by the remote host.
> >>
> >> This new host also does not permit changing perms on open files so the
> >> "late_setperm" argument must be used (as is required on all my other
>hosts).
> >> Given a choice between error 3 "The requested operation cannot be
> >> performed because there is a file transfer in progress" or error 2
> >> "Specified file path is invalid", I've opted to put in a workaround (the
> >> logic handling $FXSTAT values) to disregard error 2 from this particular
> >> host.
> >> I'd prefer eliminating the error.
> >>
> >> I am not talented enough to interpret all that is going on in
> >> Net/SFTP/Foreign/Compat.pm
> >> but I believe it is setting permissions and such, whether that is needed
> >> or not, and this is what is actually failing.
> >> I absolutely do NOT want to modify Compat.pm or any other parts of the
> >> module, for a variety of reasons.
> >> I am hoping there is some option to disable the setting of attributes.
> >
>
>
>
>
|