Michael Heemskerk created SSHD-256:
--------------------------------------

             Summary: SSH_MSG_CHANNEL_REQUEST for Putty handled incorrectly
                 Key: SSHD-256
                 URL: https://issues.apache.org/jira/browse/SSHD-256
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 0.9.0, 0.8.0, 0.7.0
            Reporter: Michael Heemskerk


Symptom:

SSH connection is kept open after the command completes when using Putty, Plink 
or TortoisePlink, or rather Putty does not finish.

See:
* https://code.google.com/p/tortoisegit/issues/detail?id=1880
* https://jira.atlassian.com/browse/STASH-3824

Cause:
ChannelSession has special handling for SSH_MSG_CHANNEL_REQUEST messages that 
are sent by Putty:

        if (type != null && type.endsWith("@putty.projects.tartarus.org")) {
            // Ignore but accept, more doc at
            // http://tartarus.org/~simon/putty-snapshots/htmldoc/AppendixF.html
            return true;
        }

There are really two problems with this workaround that was introduced in 
SSHD-77:

1) This code ignores the "want reply" flag on the field and simply ignores the 
request. According to the SSH protocol specification, the server MUST send back 
a reply (success or failure) if the "want reply" flag is set to true.
2) Putty _intentionally_ sends an invalid request and _expects_ to receive a 
SSH_MSG_CHANNEL_FAILURE response (see 
http://tartarus.org/~simon/putty-snapshots/htmldoc/AppendixF.html), which is 
the default behaviour of ChannelSession.

I don't know whether changes in Putty or changes in MinaSSHD have made the 
workaround obsolete, but it is obsolete. I've verified that without the bit of 
code I quoted above, the Putty terminates normally.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to