diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2014-08-03 22:29:49 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-12-15 12:00:49 +0100 |
commit | f818e63f8f3efaea3daf737d280450209c806541 (patch) | |
tree | 4b0067b810f9c67d4d4f88f80f18a35a72acb55d /tests/unittests | |
parent | 094aa5eb024582d23b8e0cd5ebfea3cb29ed188d (diff) | |
download | libssh-f818e63f8f3efaea3daf737d280450209c806541.tar.gz libssh-f818e63f8f3efaea3daf737d280450209c806541.tar.xz libssh-f818e63f8f3efaea3daf737d280450209c806541.zip |
Add new options
Pair-Programmed-With: Jakub Jelen <jjelen@redhat.com>
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
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_options.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c index f3197b8f..c2d6d4f9 100644 --- a/tests/unittests/torture_options.c +++ b/tests/unittests/torture_options.c @@ -239,6 +239,34 @@ static void torture_options_proxycommand(void **state) { assert_null(session->opts.ProxyCommand); } +static void torture_options_config_host(void **state) { + ssh_session session = *state; + FILE *config = NULL; + + /* 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); + fclose(config); + + ssh_options_set(session, SSH_OPTIONS_HOST, "testhost1"); + ssh_options_parse_config(session, "test_config"); + + assert_int_equal(session->opts.port, 42); + + ssh_options_set(session, SSH_OPTIONS_HOST, "testhost2"); + ssh_options_parse_config(session, "test_config"); + assert_int_equal(session->opts.port, 43); + + session->opts.port = 0; + + ssh_options_set(session, SSH_OPTIONS_HOST, "testhost3"); + ssh_options_parse_config(session, "test_config"); + assert_int_equal(session->opts.port, 43); + + unlink("test_config"); +} + #ifdef WITH_SERVER /* sshbind options */ @@ -304,6 +332,7 @@ int torture_run_tests(void) { cmocka_unit_test_setup_teardown(torture_options_proxycommand, setup, teardown), cmocka_unit_test_setup_teardown(torture_options_set_ciphers, setup, teardown), cmocka_unit_test_setup_teardown(torture_options_set_macs, setup, teardown), + cmocka_unit_test_setup_teardown(torture_options_config_host, setup, teardown) }; #ifdef WITH_SERVER |