Send post login string as SSH command when no shell session is requested. #1384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is currently no way for ConnectBot to send a command to a SSH server without allocating a PTY. The "post login string" is only ever sent if a PTY is requested and allocated, and then it is simply sent as an input to the PTY. Issue #1128 describes a similar, if not identical issue.
This is especially limiting if a remote SSH server only permits executing commands. Probably the most common example is OpenSSHd's
ForceCommand
option: It requires any command (or a shell) to be started before ForceCommand takes effect. ConnectBot, however, won't start a shell unless PTY allocation succeeds.This PR adds the following feature: If establishing a session is disabled, but a post login string is provided, the post login string is executed as a command through SSH, rather than being piped into a shell. The
local
andtelnet
transports implement post login string handling in this scenario as well, but they simply forward it to theirwrite
method in the same way theTransportBridge.injectString
method already does.