Fix connection string precedence issue

- Connection string values now properly override config file values
- Fixed issue where 'wsssht zeiss' wasn't working due to incorrect precedence logic
- Command line options still take highest precedence, then connection string, then config file
parent 397200c8
No preview for this file type
......@@ -185,26 +185,23 @@ int parse_args(int argc, char *argv[], wsssh_config_t *config, int *remaining_ar
return 0;
}
// Set values only if not already set by command line options
if (!config->service && service) {
// Set values from connection string (these take precedence over config file)
if (service) {
if (config->service) free(config->service);
config->service = service;
} else {
free(service);
}
if (!config->client_id && client_id) {
if (client_id) {
if (config->client_id) free(config->client_id);
config->client_id = client_id;
} else {
free(client_id);
}
if (!config->wssshd_host && wssshd_host) {
if (wssshd_host) {
if (config->wssshd_host) free(config->wssshd_host);
config->wssshd_host = wssshd_host;
} else {
free(wssshd_host);
}
if (config->wssshd_port == 9898 && wssshd_port != 9898) {
if (wssshd_port != 9898) {
config->wssshd_port = wssshd_port;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment