[ 
https://issues.apache.org/jira/browse/SSHD-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17197677#comment-17197677
 ] 

Lyor Goldstein commented on SSHD-1077:
--------------------------------------

You have not described in this issue the exact exception you see when you ask 
for version=3 and/or invoke the API with no version - only what happens for 
version=6 (which was to be expected) this is crucial information,
{quote}
These are the sample servers where I'm seeing issues when connecting through 
code. 
{quote}

I don't know what to  tell you - I cannot reproduce it - but you can easily 
debug and see what is going on since it seems to happen consistently for you. 
Place a breakpoint in {{DefaultSftpClient#negotiateVersion}} and run through 
it. Pay specific attention to
{code:java|title=L486-489}
        Map<String, ?> parsed = getParsedServerExtensions();
        Collection<String> extensions = ParserUtils.supportedExtensions(parsed);
        List<Integer> availableVersions = Collections.emptyList();
        if ((GenericUtils.size(extensions) > 0)
                && extensions.contains(SftpConstants.EXT_VERSION_SELECT)) {
            Versions vers = GenericUtils.isEmpty(parsed)
                    ? null
                    : (Versions) parsed.get(SftpConstants.EXT_VERSIONS);
            availableVersions = (vers == null)
                    ? Collections.singletonList(current)
                    : vers.resolveAvailableVersions(current);
{code}
I am particularly interested if the server published a "version" extension and 
if so what was its value

see also
{code:java|title=L503-515}
        ClientSession session = getClientSession();
        int selected = selector.selectVersion(session, false, current, 
availableVersions);
        if (debugEnabled) {
            log.debug("negotiateVersion({}) current={} {} -> {}",
                    clientChannel, current, availableVersions, selected);
        }

        if (selected == current) {
            return current;
        }

        if (!availableVersions.contains(selected)) {
            throw new StreamCorruptedException(
                    "Selected version (" + selected + ") not part of available: 
" + availableVersions);
        }
{code}
I am particularly interested what are the values in {{availableVersions}} when 
you ask for version=3 and/or no version at all...
{quote}Works directly from a linux box though
{quote}
Do you mean when using MINA SSHD or the Linux client ?
 Have you tried connecting to the problematic servers with WinSCP ? FileZilla ?

> Getting StreamCorruptedException while creating sftp connection
> ---------------------------------------------------------------
>
>                 Key: SSHD-1077
>                 URL: https://issues.apache.org/jira/browse/SSHD-1077
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.5.0, 2.5.1
>         Environment: Production
>            Reporter: Subramaniajeeva
>            Assignee: Lyor Goldstein
>            Priority: Major
>
> After upgrading to latest release 2.5.1, I started seeing below error when 
> connecting with sftp client:
> java.io.StreamCorruptedException: Selected version (6) not part of available: 
> [3]
>  at 
> org.apache.sshd.client.subsystem.sftp.impl.DefaultSftpClient.negotiateVersion(DefaultSftpClient.java:522)
>  ~[sshd-sftp-2.5.1.jar:2.5.1]
>  at 
> org.apache.sshd.client.subsystem.sftp.impl.DefaultSftpClientFactory.createSftpClient(DefaultSftpClientFactory.java:49)
>  ~[sshd-sftp-2.5.1.jar:2.5.1]
>  at 
> org.apache.sshd.client.subsystem.sftp.SftpClientFactory.createSftpClient(SftpClientFactory.java:59)
>  ~[sshd-sftp-2.5.1.jar:2.5.1]
>  at
>  
> There was a change done for the version selector in one of the commit around 
> May:
> [https://github.com/apache/mina-sshd/commit/a8c7e3b5d3f0525cc02d258fde361e8bd58669e5]
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to