tests: Make sure unknown options are ignored in server config
Added a test to make sure unknown options in the configuration file are ignored and don't make ssh_bind_options_parse_config() to fail. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Этот коммит содержится в:
родитель
55c637f2d3
Коммит
0fb7d9831a
@ -799,6 +799,28 @@ static void torture_server_config_hostkey_algorithms(void **state)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void torture_server_config_unknown(void **state)
|
||||||
|
{
|
||||||
|
struct test_server_st *tss = *state;
|
||||||
|
char config_content[4096];
|
||||||
|
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
assert_non_null(tss);
|
||||||
|
assert_non_null(tss->rsa_hostkey);
|
||||||
|
|
||||||
|
snprintf(config_content,
|
||||||
|
sizeof(config_content),
|
||||||
|
"HostKey %s\nUnknownOption unknown-value1,unknown-value2\n",
|
||||||
|
tss->rsa_hostkey);
|
||||||
|
|
||||||
|
rc = try_config_content(state, config_content, true);
|
||||||
|
assert_int_equal(rc, 0);
|
||||||
|
|
||||||
|
rc = try_config_content(state, config_content, false);
|
||||||
|
assert_int_equal(rc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int torture_run_tests(void) {
|
int torture_run_tests(void) {
|
||||||
int rc;
|
int rc;
|
||||||
struct CMUnitTest tests[] = {
|
struct CMUnitTest tests[] = {
|
||||||
@ -812,6 +834,8 @@ int torture_run_tests(void) {
|
|||||||
setup_temp_dir, teardown_temp_dir),
|
setup_temp_dir, teardown_temp_dir),
|
||||||
cmocka_unit_test_setup_teardown(torture_server_config_hostkey_algorithms,
|
cmocka_unit_test_setup_teardown(torture_server_config_hostkey_algorithms,
|
||||||
setup_temp_dir, teardown_temp_dir),
|
setup_temp_dir, teardown_temp_dir),
|
||||||
|
cmocka_unit_test_setup_teardown(torture_server_config_unknown,
|
||||||
|
setup_temp_dir, teardown_temp_dir),
|
||||||
};
|
};
|
||||||
|
|
||||||
ssh_init();
|
ssh_init();
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user