mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
tests: Add more reproducers for valid and invalid Match exec blocks
Fixes: T152 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
ed8284ab09
commit
4fc37bb6fe
@@ -699,6 +699,40 @@ static void torture_options_config_match(void **state)
|
|||||||
|
|
||||||
session->opts.port = 0;
|
session->opts.port = 0;
|
||||||
|
|
||||||
|
/* The Match exec keyword can accept more arguments */
|
||||||
|
torture_reset_config(session);
|
||||||
|
config = fopen("test_config", "w");
|
||||||
|
assert_non_null(config);
|
||||||
|
fputs("Match exec /bin/true 1 \n"
|
||||||
|
"\tPort 33\n"
|
||||||
|
"Match all\n"
|
||||||
|
"\tPort 34\n",
|
||||||
|
config);
|
||||||
|
fclose(config);
|
||||||
|
|
||||||
|
rv = ssh_options_parse_config(session, "test_config");
|
||||||
|
assert_ssh_return_code(session, rv);
|
||||||
|
assert_int_equal(session->opts.port, 34);
|
||||||
|
|
||||||
|
session->opts.port = 0;
|
||||||
|
|
||||||
|
/* Commands containing whitespace characters must be quoted. */
|
||||||
|
torture_reset_config(session);
|
||||||
|
config = fopen("test_config", "w");
|
||||||
|
assert_non_null(config);
|
||||||
|
fputs("Match exec \"/bin/true 1\"\n"
|
||||||
|
"\tPort 33\n"
|
||||||
|
"Match all\n"
|
||||||
|
"\tPort 34\n",
|
||||||
|
config);
|
||||||
|
fclose(config);
|
||||||
|
|
||||||
|
rv = ssh_options_parse_config(session, "test_config");
|
||||||
|
assert_ssh_return_code(session, rv);
|
||||||
|
assert_int_equal(session->opts.port, 34);
|
||||||
|
|
||||||
|
session->opts.port = 0;
|
||||||
|
|
||||||
unlink("test_config");
|
unlink("test_config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user