[
https://issues.apache.org/jira/browse/SSHD-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15883069#comment-15883069
]
Goldstein Lyor commented on SSHD-728:
-------------------------------------
Found it - the issue occurs because of the following lines:
{code:java|title=SftpSubsystem#doRead}
int requestedLength = buffer.getInt();
int maxAllowed = PropertyResolverUtils.getIntProperty(getServerSession(),
MAX_PACKET_LENGTH_PROP, DEFAULT_MAX_PACKET_LENGTH);
int readLen = Math.min(requestedLength, maxAllowed);
{code}
Some trivial logging shows:
{noformat}
doRead(ServerSessionImpl[a@/0:0:0:0:0:0:0:1:53628])[id=267](9811224e930c354fe005a583704d81b5)[offset=2595736]
- req=32768, max=16384, effective=16384
{noformat}
In other words, the code is "truncating" the requested length (for protecting
against malicious attacks). For now (until I fix this and it is released) there
is a quick fix - configure the server's {{sftp-max-packet-length}} value to be
higher than 32768 (the size requested by FileZilla):
{code:java}
// Add this line to the server initialization code
PropertyResolverUtils.updateProperty(sshd,
SftpSubsystem.MAX_PACKET_LENGTH_PROP, 36 * 1024);
{code}
I will release a fix for it soon
> sshd-core sftp not working with FileZilla sftp client
> -----------------------------------------------------
>
> Key: SSHD-728
> URL: https://issues.apache.org/jira/browse/SSHD-728
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 1.3.0
> Reporter: tntim96
> Assignee: Goldstein Lyor
>
> I've upgraded from sshd-core 0.14.0 to 1.3.0. FileZilla file download for
> largish files worked on 0.14.0 but not 1.3.0.
> Steps to reproduce:
> # Set up a server with the code below
> # Make sure there is a largish file to download (I tested with size 1048576)
> # Connect to the server with FileZilla (I tried version 3.9.0.5)
> # Try to download the file
> # The error {noformat}Error: error while reading: received a short buffer
> from FXP_READ, but not at EOF
> Error: File transfer failed after transferring 16384 bytes in 1
> second{noformat} appears in the FileZilla logs
> # Multiple FileZilla popups to overwrite the file appear (obviously connected
> to the error above)
> # The download fails
> {code:title=Simple configuration to generate error}
> SshServer sshd = SshServer.setUpDefaultServer();
> sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
> sshd.setPort(2222);
> sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);
> sshd.setPasswordAuthenticator((username, password, session) ->
> Objects.equals(username, password));
> sshd.setPublickeyAuthenticator(AcceptAllPublickeyAuthenticator.INSTANCE);
> sshd.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
> sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(
> command -> new ProcessShellFactory(GenericUtils.split(command, '
> ')).create()
> ).build());
> sshd.setSubsystemFactories(Collections.singletonList(new
> SftpSubsystemFactory()));
> sshd.start();
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)