tests: Adjust test that require complete config re-parsing

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2018-10-30 12:52:32 +01:00
committed by Andreas Schneider
parent de7405f1c7
commit 9aa47fef99
2 changed files with 19 additions and 0 deletions

View File

@@ -287,6 +287,7 @@ static void torture_config_auth_methods(void **state) {
assert_int_equal(session->opts.flags, 0);
/* gradually enable them again */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_HOST, "gss");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG8);
assert_true(ret == 0);
@@ -341,29 +342,34 @@ static void torture_config_match(void **state)
assert_string_equal(session->opts.host, "all-matched.com");
/* Hostname example does simple hostname matching */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_HOST, "example");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);
assert_true(ret == 0);
assert_string_equal(session->opts.host, "example.com");
/* We can match also both hosts from a comma separated list */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_HOST, "example1");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);
assert_true(ret == 0);
assert_string_equal(session->opts.host, "exampleN");
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_HOST, "example2");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);
assert_true(ret == 0);
assert_string_equal(session->opts.host, "exampleN");
/* We can match by user */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_USER, "guest");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);
assert_true(ret == 0);
assert_string_equal(session->opts.host, "guest.com");
/* We can combine two options on a single line to match both of them */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_USER, "tester");
ssh_options_set(session, SSH_OPTIONS_HOST, "testhost");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);
@@ -371,6 +377,7 @@ static void torture_config_match(void **state)
assert_string_equal(session->opts.host, "testhost.com");
/* We can also negate conditions */
SAFE_FREE(session->opts.options_seen);
ssh_options_set(session, SSH_OPTIONS_USER, "not-tester");
ssh_options_set(session, SSH_OPTIONS_HOST, "testhost");
ret = ssh_config_parse_file(session, LIBSSH_TESTCONFIG10);