mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 10:40:28 +09:00
config: Do not overwrite previously matched result in Host blocks
The match_hostname() expects comma separated list, while the Host
config keyword in openssh uses spaces separated list by default.
Therefore any subseqent match or negated match in space separated
list will overwrite the previous matches.
This also adjusts the tests to make sure both of the versions work.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 9f5f10552b)
This commit is contained in:
committed by
Andreas Schneider
parent
2787756efe
commit
bad407f5e2
@@ -359,7 +359,10 @@ static void torture_options_config_host(void **state) {
|
||||
/* create a new config file */
|
||||
config = fopen("test_config", "w");
|
||||
assert_non_null(config);
|
||||
fputs("Host testhost1\nPort 42\nHost testhost2,testhost3\nPort 43\n", config);
|
||||
fputs("Host testhost1\nPort 42\n"
|
||||
"Host testhost2,testhost3\nPort 43\n"
|
||||
"Host testhost4 testhost5\nPort 44\n",
|
||||
config);
|
||||
fclose(config);
|
||||
|
||||
ssh_options_set(session, SSH_OPTIONS_HOST, "testhost1");
|
||||
@@ -377,6 +380,16 @@ static void torture_options_config_host(void **state) {
|
||||
ssh_options_parse_config(session, "test_config");
|
||||
assert_int_equal(session->opts.port, 43);
|
||||
|
||||
ssh_options_set(session, SSH_OPTIONS_HOST, "testhost4");
|
||||
ssh_options_parse_config(session, "test_config");
|
||||
assert_int_equal(session->opts.port, 44);
|
||||
|
||||
session->opts.port = 0;
|
||||
|
||||
ssh_options_set(session, SSH_OPTIONS_HOST, "testhost5");
|
||||
ssh_options_parse_config(session, "test_config");
|
||||
assert_int_equal(session->opts.port, 44);
|
||||
|
||||
unlink("test_config");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user