Skip to content

SFTP transfer broken if buffer > 100Kb #1395

@pwo

Description

@pwo

"OpenSSH for Windows" version
7.7.2.2

Server OperatingSystem
Windows Server 2019 Standard

Client OperatingSystem
CentOS Linux release 7.6.1810 (Core)
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017

What is failing
Using a sftp buffer greater than 102400 fails to transfer large files.
$ ls -l fil
-rw-r--r--. 1 root root 1048576 May 31 16:52 fil
$ sftp -B 102401 sshtest@windows-server
sshtest@windows-server's password:
Connected to windows-server.
sftp> put fil
Uploading fil to /fil
fil 9% 100KB 8.8MB/s 00:00 ETA
Couldn't write to remote file "/fil": Failure
sftp>

This is related to the 100Kb read/write buffers in fileio.c

This can not be triggered from a Windows sftp.exe client because the read buffer is also capped to 102400 bytes.

Expected output
File uploaded successfully.

Actual output
3716 2019-05-31 16:55:30.395 session opened for local user sshtest from [a.b.c.d]
3716 2019-05-31 16:55:30.395 received client version 3
3716 2019-05-31 16:55:30.395 debug3: request 1: realpath
3716 2019-05-31 16:55:30.395 realpath "."
3716 2019-05-31 16:55:30.395 debug1: request 1: sent names count 1
3716 2019-05-31 16:55:31.656 debug3: request 2: open flags 26
3716 2019-05-31 16:55:31.656 open "/fil" flags WRITE,CREATE,TRUNCATE mode 0644
3716 2019-05-31 16:55:31.656 debug1: request 2: sent handle handle 0
3716 2019-05-31 16:55:31.671 debug1: request 3: write "/fil" (handle 0) off 0 len 102401
3716 2019-05-31 16:55:31.671 debug2: nothing at all written
3716 2019-05-31 16:55:31.671 debug3: request 3: sent status 4
3716 2019-05-31 16:55:31.671 sent status Failure
3716 2019-05-31 16:55:31.671 debug3: request 3: close handle 0
3716 2019-05-31 16:55:31.671 close "/fil" bytes read 0 written 0
3716 2019-05-31 16:55:31.671 debug3: request 3: sent status 0
3716 2019-05-31 16:55:31.671 sent status Success
3716 2019-05-31 16:55:39.810 debug1: read eof
3716 2019-05-31 16:55:39.810 session closed for local user sshtest from [a.b.c.d]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions