diff options
author | Jakub Jelen <jjelen@redhat.com> | 2021-01-28 19:10:51 +0100 |
---|---|---|
committer | Jakub Jelen <jjelen@redhat.com> | 2021-01-28 19:11:58 +0100 |
commit | cb7ce1813b58d717789dafb8818b0698f8dcf200 (patch) | |
tree | bd0d3b7df015341d4b80d7a2e9b4b5a252c38247 /tests/unittests | |
parent | a9061ab434c5789c7e369b8819625ae38ed62005 (diff) | |
download | libssh-cb7ce1813b58d717789dafb8818b0698f8dcf200.tar.gz libssh-cb7ce1813b58d717789dafb8818b0698f8dcf200.tar.xz libssh-cb7ce1813b58d717789dafb8818b0698f8dcf200.zip |
tests: Verify the configuration can set more identity files from one configuration file
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/torture_config.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unittests/torture_config.c b/tests/unittests/torture_config.c index 7ae846a4..08b67deb 100644 --- a/tests/unittests/torture_config.c +++ b/tests/unittests/torture_config.c @@ -168,6 +168,11 @@ extern LIBSSH_THREAD int ssh_log_level; "Host time4\n" \ "\tRekeyLimit default 9600\n" +/* Multiple IdentityFile settings all are aplied */ +#define LIBSSH_TESTCONFIG_STRING13 \ + "IdentityFile id_rsa_one\n" \ + "IdentityFile id_ecdsa_two\n" + #define LIBSSH_TEST_PUBKEYTYPES_STRING \ "PubkeyAcceptedKeyTypes "PUBKEYACCEPTEDTYPES"\n" @@ -1610,6 +1615,28 @@ static void torture_config_match_pattern(void **state) } +/* Identity file can be specified multiple times in the configuration + */ +static void torture_config_identity(void **state) +{ + const char *id = NULL; + struct ssh_iterator *it = NULL; + ssh_session session = *state; + + _parse_config(session, NULL, LIBSSH_TESTCONFIG_STRING13, SSH_OK); + + it = ssh_list_get_iterator(session->opts.identity); + assert_non_null(it); + id = it->data; + /* The identities are prepended to the list so we start with second one */ + assert_string_equal(id, "id_ecdsa_two"); + + it = it->next; + assert_non_null(it); + id = it->data; + assert_string_equal(id, "id_rsa_one"); +} + int torture_run_tests(void) { @@ -1669,6 +1696,8 @@ int torture_run_tests(void) setup, teardown), cmocka_unit_test_setup_teardown(torture_config_match_pattern, setup, teardown), + cmocka_unit_test_setup_teardown(torture_config_identity, + setup, teardown), }; |