You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Alex D (Jira)" <ji...@apache.org> on 2021/03/19 13:20:00 UTC

[jira] [Created] (SSHD-1147) SftpClient is not able to download file from proprietory SFTP servers (IBM) with a one time download policy

Alex D created SSHD-1147:
----------------------------

             Summary: SftpClient is not able to download file from proprietory SFTP servers (IBM) with a one time download policy
                 Key: SSHD-1147
                 URL: https://issues.apache.org/jira/browse/SSHD-1147
             Project: MINA SSHD
          Issue Type: Wish
    Affects Versions: 2.5.1
            Reporter: Alex D


Some propretory SFTP servers support a so-called "one time download" policy also known as Extractability Count.

Current implementation of the input stream based read ofile operation [org|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg]{color:#000000}.{color}[apache|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache]{color:#000000}.{color}[sshd|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd]{color:#000000}.{color}[client|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client]{color:#000000}.{color}[subsystem|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem]{color:#000000}.{color}[sftp|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem.sftp]{color:#000000}.SftpClient{color}::read(String path) uses [org|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg]{color:#000000}.{color}[apache|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache]{color:#000000}.{color}[sshd|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd]{color:#000000}.{color}[client|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client]{color:#000000}.{color}[subsystem|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem]{color:#000000}.{color}[sftp|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem.sftp]{color:#000000}.{color}[impl|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem.sftp.impl]{color:#000000}.{color}[SftpInputStreamAsync|eclipse-javadoc:%E2%98%82=nt-common/%5C/home%5C/ghost%5C/.m2%5C/repository%5C/org%5C/apache%5C/sshd%5C/sshd-sftp%5C/2.5.1%5C/sshd-sftp-2.5.1.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.apache.sshd=/=/maven.artifactId=/sshd-sftp=/=/maven.version=/2.5.1=/=/maven.scope=/compile=/%3Corg.apache.sshd.client.subsystem.sftp.impl(SftpInputStreamAsync.class%E2%98%83SftpInputStreamAsync]
which performs 2 operations in its constructor:
1) Open remote file (SftpClient::open)
2) Calculate remote file size using file's handle obtained in 1)

As a result the following error is produced on attempt to download a file from IBMs SFTP:
SFTP error (SSH_FX_FAILURE): The message [remote file path] is not extractable!


IBM specifically states that it's not their problem at all, and they are not going to fix it.
According to their flow described here:
[https://www.ibm.com/support/pages/node/1121475?lang=en]

"Any attempt from client to issue other SFTP operations like SSH_FXP_STAT (reading attributes) makes server to validate extractability_count > 0.
If found 0, download would be reported as "not extractable".

Most likely it's possible to use SftpClient::openRemoteFileChannel and work with the obtained FileChannel manually without any additional requests to stat remote file size (not yet verified/confirmed).
Though it would be a cumbersome approach, as reading remote file in chunks not knowing its size in this case will be far from optimal.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org