Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSHD-968 interpret SSH_MSG_UNIMPLEMENTED response to a global request as its failure #114

Closed
wants to merge 4 commits into from

Conversation

lgoldstein
Copy link
Contributor

The main flow is as follows:

  • when AbstractSession#preProcessEncodeBuffer override is called as part of sending the global request, it checks if the buffer about to be encoded and written is a SSH_MSG_GLOBAL_REQUEST command. If so, it stores the outgoing message sequence number in case SSH_MSG_UNIMPLEMENTED is reported for it.

  • AbstractSession#request resets the tracked global request outgoing sequence number if either a response was received or timeout expired.

  • AbstractSession#doInvokeUnimplementedMessageHandler override checks if the reported message number matches the currently tracked global request message and converts it to a message failure signal instead (thus releasing the AbstractSession#request loop waiting for it).

@gnodet
Copy link
Contributor

gnodet commented Feb 27, 2020

I thought you wanted a less invasive fix ;-)
I don't really like the artificial split with the introduction of the preProcessEncodeBuffer method as it's only called from AbstractSession. encode, while the preProcessEncodeBuffer is defined in the SessionHelper and overriden in the AbstractSession. This looks rather complex instead of simply adding the few needed lines in the existing encode method (efdb7c3#diff-916a03c44b5846431681a4411891d952R843-R849).
Anyway, if you really wanted something simple, we could go for gnodet@cdefec7 which is much simpler ;-)

@lgoldstein
Copy link
Contributor Author

I thought you wanted a less invasive fix ;-)

I did not mean less invasive as much as less aware of the purpose of the changes. It is less invasive as far as existing methods since it only introduces new ones.

I don't really like the artificial split with the introduction of the preProcessEncodeBuffer method as it's only called from AbstractSession. encode, while the preProcessEncodeBuffer is defined in the SessionHelper and overriden in the AbstractSession. This looks rather complex instead of simply adding the few needed lines in the existing encode method (efdb7c3#diff-916a03c44b5846431681a4411891d952R843-R849).

True, but it was the only way that I could come up with - IMO encode already does so much (lots of code for one method) so I thought it would make sense to split it rather than add to it. Anyway, like I said it opens up the door for future fixes/extension - e.g., perhaps one of the derived classes from AbsractSession needs something else.

Anyway, if you really wanted something simple, we could go for gnodet/mina-sshd@cdefec7 which is much simpler ;-)

True, but IMO this fix while more complex feels more robust. Any objections to merging it ?

@gnodet
Copy link
Contributor

gnodet commented Feb 27, 2020

No objections, go for it.

@lgoldstein lgoldstein force-pushed the SSHD-968 branch 2 times, most recently from 0f84da0 to f937ec8 Compare February 28, 2020 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants