Bug 3109 - Failure when sftp-server writes big data chunks on Windows
Summary: Failure when sftp-server writes big data chunks on Windows
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp-server (show other bugs)
Version: 8.1p1
Hardware: Other Windows 10
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_8_4
  Show dependency treegraph
 
Reported: 2020-01-06 22:07 AEDT by Adi Roiban
Modified: 2020-10-02 14:55 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adi Roiban 2020-01-06 22:07:18 AEDT
Not sure if this is a defect or a request for improvements.

I am reporting this bug here in the case in which someone else has to deal with this error.

I am implementing a custom SFTP client which interacts with OpenSSH SFTP server.

I have observed this issue only on Windows... most probably due to Windows `write` function implementation.

I am trying to do a SFTP write request using a big chunk: 160kB.

Other SFTP clients like Putty psftp.exe use 4kB for the SFTP write request.

The problem is that Windows API fails to make the write call with a big data chunk.
Using smaller chunks works.

The OpenSSH SFTP server error `debug2("nothing at all written");` is missleading as some data is actually written... just that not the whole data.

Not sure how to properly fix this.
The SFTP protocol RFC has no special status code for a partial write.

In an ideal case, OpenSSH SFTP would have a separate condition and send a different debug message when partial data is write... but this will not help the remote client.

What could help a remote SFTP client is send a human readable text message together with the SFTP_FAILURE (code 4) status.

But I see that all the send_status call in OpenSSH are without a human readable message.


The code is here:

https://github.com/openssh/openssh-portable/blob/master/sftp-server.c#L813


You can close this bug as I think the best thing to do is to have the SFTP RFC updated with a dedicated error code when chunk size is too big and the client can adjust the size.
Comment 1 Damien Miller 2020-07-17 13:53:23 AEST
I have made sftp-server log the reason for the failed write in the local log. At least that way the errors can be identified.
Comment 2 Darren Tucker 2020-10-02 14:55:03 AEST
Mass close of all bugs fixed in 8.4 release.