[SFTP] Read from write-only file not returning error

Nikolaus Rath
2017-08-06T09:29:28Z

Hello,

I am investigating a data-loss bug in SSHFS
(https://github.com/libfuse/sshfs/issues/72). While the root cause is in
SSHFS and has already been fixed, there seems to be some unfortunate
interaction with what I believe is an OpenSSH bug:

As far as I can tell, when sending a SSH_FXP_OPEN request with
SSH_FXF_WRITE (i.e., opening the file write only), and then following up
with a SSH_FXP_READ, the server responds with a SSH_FXP_STATUS
indicating that all data has been read.

Shouldn't the server signal some kind of error instead? Or am I making a
mistake in parsing the response?

Thanks,
-Nikolaus

--
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             ?Time flies like an arrow, fruit flies like a Banana.?