The ignoreMatchDirective flag did not exist in the newConfig function.
Because this function is called when generating a config for connections
in an included file, those connections automatically assumed the value
was false. This change adds the flag so it can be changed to true if it
is also set for the outer configuration.
* Add the possibility to ignore the Match directive
* cleanup
* cleanup
* cleanup
* cleanup
* fix: duplicated code leftover from merge
* fix: match directive bypass for GetAll
The new ignoreMatchDirective flag needed to be added in one other place.
---------
Co-authored-by: fferro <francesco.ferro@yahooinc.com>
Credit to @virtuald for the original implementation of this fix.
* Add support for retrieving all IdentityFile directives via DefaultAll
* fix: set IdentityFile defaults to match man page
The existing default IdentityFile list was incomplete and out of order.
This updates it to match the defaults listed here:
https://man7.org/linux/man-pages/man5/ssh_config.5.html
---------
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
* add function that can clear cached config files
Once the first call to `Get()`, `GetStrict()`, `GetAll()`,
or`GetAllStrict()` has been made, the contents of the config files will
be cached for all future calls to any of those functions. This can be
frustrating if the user wants to capture changes to the config file that
were made externally. This
change adds the `ClearCachedConfigs()` function to provide control over
that.
* change ClearCachedConfigs to ReloadConfigs
Clearing cached data is somewhat vague and could be more confusing to
users who are not familiar with this library. But Reloading the config
data is very straightforward. For this reason, the ability to clear the
cache has been replaced with the ability to reload.
The reload simply clears the cache and then loads the contents again.
Additionally, this contains a bug fix that ensure the loadConfigs
pointer is set to a non-null value before it is used.
* add tests for reloading ssh config files
This adds 2 tests. The first checks that ssh config data is cached and
does not update if the file changes afterward. The second checks that
the `ReloadConfigs()` function will discard the cached data and load the
current config file contents.
See the description in the CHANGELOG - we were handling this
incorrectly and attaching whitespace to the end of values where that
didn't make much sense to do.
IdentityFile among others supports being provided multiple times and
aggregated across, potentially, multiple files. Support that workflow
by adding GetAll and GetAllStrict alongside the current functions.