ssh_options_set does not update the session’s error state on bad host
With libssh 0.10.6, ssh_options_set with SSH_OPTIONS_HOST calls ssh_config_parse_uri and returns -1 on error without calling ssh_set_error_invalid(session). The symptom is that even though ssh_options_set returns -1, ssh_get_error returns no useful error message.
To reproduce, set SSH_OPTIONS_HOST to a value containing an underscore, like "foo_bar"
. ssh_options_set will return -1 but ssh_get_error will return nothing.
Here is the relevant code in src/options.c
, at the definition of ssh_options_set:
switch (type) {
case SSH_OPTIONS_HOST:
v = value;
if (v == NULL || v[0] == '\0') {
ssh_set_error_invalid(session);
return -1;
} else {
char *username = NULL, *hostname = NULL, *port = NULL;
rc = ssh_config_parse_uri(value, &username, &hostname, &port);
if (rc != SSH_OK) {
return -1;
}
ssh_config_parse_uri does not receive the session, so it should be the responsability of ssh_options_set to call ssh_set_error, like it does when v is empty.