-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve support for obscure ssh_config(5) rules #68
Conversation
It's reasonable to end the config with a section directive (e.g., Match final' to trigger a re-parse), in which case there is no prior line within the config to attach the whitespace to. Extend the logic to annotate the most recent section directive if it's sub-config is empty. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
ssh_config(5) defines three Match criteria that don't take any arguments: 'all', 'canonical', and 'final'. Update the criteria parsing logic to recognise these. The value is irrelevant, but the criteria are stored in a map, so an empty array is chosen here. Consumers really shouldn't be trying to use any particular value though. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Add some testing to assert that Match criteria without arguments ('all', 'canonical', and 'final') are parsed correctly. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
When User is passed in the params, it acts as if the config started with an unconditional User line. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
When a user is passed explicitly to .compute, it should not switch because of any User lines. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Computing a config potentially performs multiple passes, with some quirks around what exactly the host is in 'Host' and 'Match host' sections. Extend .compute to handle more cases of 'all' and 'final'. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Test some cases of parsing configs with second passes due to Match final or similar. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #68 +/- ##
===========================================
- Coverage 100.00% 96.96% -3.04%
===========================================
Files 2 3 +1
Lines 231 297 +66
Branches 0 81 +81
===========================================
+ Hits 231 288 +57
- Misses 0 4 +4
- Partials 0 5 +5
☔ View full report in Codecov by Sentry. |
v4.3.0 released |
There are some obscure interactions in the SSH config parsing rules. This PR extends support for some of these, which addresses the bug that prompted jeanp413/open-remote-ssh#103.
The
canonical
criteria is not properly supported in this series because I don't use it, so don't really have a sense for what it should be doing. It shouldn't be too hard to extend support for it too though, now that the second pass is possible.