aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-06-13 16:48:01 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-06-14 07:48:01 +0200
commit4fc37bb6fed94048ab4eeb361ec7c261aae41333 (patch)
tree47ffd407d59fb7d1dc89311a4a302b6306e73a77 /tests/unittests
parented8284ab0976130c6c1001e2e370593d00675007 (diff)
downloadlibssh-4fc37bb6fed94048ab4eeb361ec7c261aae41333.tar.gz
libssh-4fc37bb6fed94048ab4eeb361ec7c261aae41333.tar.xz
libssh-4fc37bb6fed94048ab4eeb361ec7c261aae41333.zip
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>
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/torture_options.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index a4278623..6ae99e7b 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -699,6 +699,40 @@ static void torture_options_config_match(void **state)
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");
}