mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Tatham (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SSHD-256) SSH_MSG_CHANNEL_REQUEST for Putty handled incorrectly
Date Tue, 24 Sep 2013 10:29:05 GMT

     [ https://issues.apache.org/jira/browse/SSHD-256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Simon Tatham updated SSHD-256:

    Attachment: 0001-Consistently-send-replies-to-channel-requests.patch

I've been investigating this same issue (having had it reported initially as a bug against
PuTTY). I agree that Michael Heemskerk's patch is sensible, but I also think that the problem
with ignoring the "want reply" flag goes considerably further than just this one request type.
I looked through the request handling in the various channel classes and discovered that "want
reply" is often ignored in other situations, which is a source of further latent bugs just
waiting for a peer implementation to trigger them.

I've attached my own suggested patch which centralises the handling of responses to channel
requests, so as to make sure a response is _always_ sent if "want reply" is true, and _never_
sent if it is not, regardless of the channel type or whether the request is recognised. I
haven't been conveniently able to check the behaviour in previously failing cases, but I have
run the result through "mvn test" which reported no failures.

I would recommend applying this patch _in addition_ to Michael Heemskerk's patch.
> 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.7.0, 0.8.0, 0.9.0
>            Reporter: Michael Heemskerk
>         Attachments: 0001-Consistently-send-replies-to-channel-requests.patch
> 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

View raw message