mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-01 11:26:52 +03:00
config: Be less strict when parsing unknown Match keywords
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
16
src/config.c
16
src/config.c
@ -1010,17 +1010,17 @@ ssh_config_parse_line(ssh_session session,
|
|||||||
|
|
||||||
case MATCH_UNKNOWN:
|
case MATCH_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
ssh_set_error(session, SSH_FATAL,
|
SSH_LOG(SSH_LOG_WARN,
|
||||||
"ERROR - Unknown argument '%s' for Match keyword", p);
|
"Unknown argument '%s' for Match keyword. Not matching",
|
||||||
SAFE_FREE(x);
|
p);
|
||||||
return -1;
|
result = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} while (p != NULL && p[0] != '\0');
|
} while (p != NULL && p[0] != '\0');
|
||||||
if (args == 0) {
|
if (args == 0) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
SSH_LOG(SSH_LOG_WARN,
|
||||||
"ERROR - Match keyword requires an argument");
|
"ERROR - Match keyword requires an argument. Not matching");
|
||||||
SAFE_FREE(x);
|
result = 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
*parsing = result;
|
*parsing = result;
|
||||||
break;
|
break;
|
||||||
|
@ -959,7 +959,9 @@ static void torture_config_match(void **state,
|
|||||||
string = config;
|
string = config;
|
||||||
}
|
}
|
||||||
torture_reset_config(session);
|
torture_reset_config(session);
|
||||||
_parse_config(session, file, string, SSH_ERROR);
|
ssh_options_set(session, SSH_OPTIONS_HOST, "unmatched");
|
||||||
|
_parse_config(session, file, string, SSH_OK);
|
||||||
|
assert_string_equal(session->opts.host, "unmatched");
|
||||||
|
|
||||||
/* Missing argument to unsupported option originalhost */
|
/* Missing argument to unsupported option originalhost */
|
||||||
config = "Match originalhost\n"
|
config = "Match originalhost\n"
|
||||||
|
@ -1070,7 +1070,7 @@ static void torture_options_config_match(void **state)
|
|||||||
fclose(config);
|
fclose(config);
|
||||||
|
|
||||||
rv = ssh_options_parse_config(session, "test_config");
|
rv = ssh_options_parse_config(session, "test_config");
|
||||||
assert_ssh_return_code_equal(session, rv, SSH_ERROR);
|
assert_ssh_return_code_equal(session, rv, SSH_OK);
|
||||||
|
|
||||||
/* The Match all keyword needs to be the only one (start) */
|
/* The Match all keyword needs to be the only one (start) */
|
||||||
torture_reset_config(session);
|
torture_reset_config(session);
|
||||||
|
Reference in New Issue
Block a user