Hello all,

I'm currently implementing support to set the server (bind) options through 
configuration files. The current state can be followed in the PR I've opened in 
gitlab [0].

During the implementation, I realized some expected behaviors are not clearly 
defined (or documented), being the main issue related with the precedence of 
the options. I followed the implementation of the client side (session) options 
configuration as close as I could.

So the questions are:
 * Currently if one option is set by one configuration file, the next 
configuration file can't set it again. Is this the expected behavior from the 
user point of view?
   - note: This is used to not override user options with the global default 
options. The user options are parsed and then the global options are parsed. 
The ones set before are kept. In my opinion it would be better to reverse the 
logic and parse the global options before and override them with the user 
options as he or she prefers.

 * If the user sets one option manually (through ssh_options_set()), but the 
option is defined in the global configuration file, the global setting will 
overwrite the user setting. Is this expected?
   - note: This happens because setting options manually does not set the bool 
in the session.options_seen table. When the user calls ssh_connect(), the 
global configuration will be parsed, overwriting the options set manually by 
the user. In my opinion, the manually set options should be kept.
 
Resuming, the best for me would be:
 - The global configuration is parsed before any other
 - Settings done manually by the user (either by calling ssh_options_set() or 
ssh_options_parse_config()) take precedence over the global settings, being 
kept the last set.
 - Global settings done automatically (e.g. the one called in ssh_connect()) 
don't override manually set options

Other than this, it would be better to be able to define the default location 
of the global configuration file in build (cmake) time, instead of having it 
hardcoded.

Thank you,
Anderson

[0] https://gitlab.com/libssh/libssh-mirror/merge_requests/6

Reply via email to