Open
Conversation
By just splitting at spaces, multi-word arguments are torn apart even if quoted. In case of custom ssh-cmd, this makes it practically impossible to set certian options through `ssh -o`. shlex splits arguments like a shell and e.g. respects quotes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I tried setting a multi-word SSH option through
ssh -oandsshuttle -e. This didn't work because regardless of the quoting, sshuttle always split the option into multiple arguments and made the quotes become a literal part of the args.The problem turned out to be caused by shuttle always splitting the arguments at spaces, which makes it practically impossible to have multi-word arguments.
This patch solves the issue by using Python's shlex module, which splits arguments like a shell and e.g. respects quotes. I found one more similar line in the sshuttle code and fixed that one as well.