diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-05-13 11:55:30 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-05-14 17:32:25 +0200 |
commit | 38f9802eec067454a421eebfcae087c79bc02c67 (patch) | |
tree | d56326e9c5fe1b9108dc0d6f8cb99ca625790c17 | |
parent | eae971c0027726d723456bd1c5266764caf094bb (diff) | |
download | libssh-38f9802eec067454a421eebfcae087c79bc02c67.tar.gz libssh-38f9802eec067454a421eebfcae087c79bc02c67.tar.xz libssh-38f9802eec067454a421eebfcae087c79bc02c67.zip |
config: Add support for PubkeyAcceptedKeyTypes
The added option is an alias for the previously existing option
PubkeyAcceptedTypes.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/config.c | 1 | ||||
-rw-r--r-- | tests/unittests/torture_config.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 4268545d..c0471136 100644 --- a/src/config.c +++ b/src/config.c @@ -147,6 +147,7 @@ static struct ssh_config_keyword_table_s ssh_config_keyword_table[] = { { "tunnel", SOC_NA}, { "tunneldevice", SOC_NA}, { "xauthlocation", SOC_NA}, + { "pubkeyacceptedkeytypes", SOC_PUBKEYACCEPTEDTYPES}, { NULL, SOC_UNKNOWN } }; diff --git a/tests/unittests/torture_config.c b/tests/unittests/torture_config.c index 55b0f038..baf90428 100644 --- a/tests/unittests/torture_config.c +++ b/tests/unittests/torture_config.c @@ -21,6 +21,7 @@ extern LIBSSH_THREAD int ssh_log_level; #define LIBSSH_TESTCONFIG11 "libssh_testconfig11.tmp" #define LIBSSH_TESTCONFIG12 "libssh_testconfig12.tmp" #define LIBSSH_TESTCONFIGGLOB "libssh_testc*[36].tmp" +#define LIBSSH_TEST_PUBKEYACCEPTEDKEYTYPES "libssh_test_PubkeyAcceptedKeyTypes.tmp" #define USERNAME "testuser" #define PROXYCMD "ssh -q -W %h:%p gateway.example.com" @@ -50,6 +51,7 @@ static int setup_config_files(void **state) unlink(LIBSSH_TESTCONFIG10); unlink(LIBSSH_TESTCONFIG11); unlink(LIBSSH_TESTCONFIG12); + unlink(LIBSSH_TEST_PUBKEYACCEPTEDKEYTYPES); torture_write_file(LIBSSH_TESTCONFIG1, "User "USERNAME"\nInclude "LIBSSH_TESTCONFIG2"\n\n"); @@ -180,6 +182,9 @@ static int setup_config_files(void **state) "\tRekeyLimit default 9600\n" ""); + torture_write_file(LIBSSH_TEST_PUBKEYACCEPTEDKEYTYPES, + "PubkeyAcceptedKeyTypes "PUBKEYACCEPTEDTYPES"\n"); + session = ssh_new(); verbosity = torture_libssh_verbosity(); @@ -204,6 +209,7 @@ static int teardown(void **state) unlink(LIBSSH_TESTCONFIG10); unlink(LIBSSH_TESTCONFIG11); unlink(LIBSSH_TESTCONFIG12); + unlink(LIBSSH_TEST_PUBKEYACCEPTEDKEYTYPES); ssh_free(*state); @@ -836,6 +842,19 @@ static void torture_config_rekey(void **state) } +/** + * @brief test ssh_config_parse_file with PubkeyAcceptedKeyTypes + */ +static void torture_config_pubkeyacceptedkeytypes(void **state) +{ + ssh_session session = *state; + int rc; + + rc = ssh_config_parse_file(session, LIBSSH_TEST_PUBKEYACCEPTEDKEYTYPES); + assert_int_equal(rc, SSH_OK); + assert_string_equal(session->opts.pubkey_accepted_types, PUBKEYACCEPTEDTYPES); +} + int torture_run_tests(void) { int rc; struct CMUnitTest tests[] = { @@ -848,6 +867,7 @@ int torture_run_tests(void) { cmocka_unit_test(torture_config_match), cmocka_unit_test(torture_config_proxyjump), cmocka_unit_test(torture_config_rekey), + cmocka_unit_test(torture_config_pubkeyacceptedkeytypes), }; |