You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by John Hartnup <jo...@gmail.com> on 2012/08/28 16:47:07 UTC

Handling SFTP 'get' on a non-existent file

Hi,

I'm writing my own SshFile subclasses, and I've hit an issue where Putty's
PSFTP client tries to open files for reading, which don't exist.

OpenSSH sftp sends a STAT, gets a NO_SUCH_FILE response then stops.

PSFTP seems to send an OPEN regardless of the NO_SUCH_FILE sent in response
to STAT. It gets a valid filehandle back, and proceeds to do a bunch of
READS. I send back an EOFException, which results in "error while reading:
failure" on the client side. But that's not as good as the "file not found"
reported by OpenSSH.

PSFTP uses V3 OPEN. I see that the version<4 branch in sftpsubsystem.java
has nothing that responds with NO_SUCH_FILE, whereas the version>=4 branch
can send NO_SUCH_FILE depending on open's flags.

Is this fixable, or is it inherently something the V3 protocol can't
handle? What should my file class do?

-- 
"There is no way to peace; peace is the way"