|
|
9cb92d |
From 43dc5617a037f60e4560cb33c050815e03ccdff0 Mon Sep 17 00:00:00 2001
|
|
|
9cb92d |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
9cb92d |
Date: Tue, 7 Jan 2014 10:43:55 +0100
|
|
|
9cb92d |
Subject: [PATCH 126/126] tests: Remove tests that check creating public
|
|
|
9cb92d |
directories
|
|
|
9cb92d |
|
|
|
9cb92d |
The functionality was removed, but we forgot to remove the corresponding
|
|
|
9cb92d |
tests, mostly because these tests were only ever ran as root.
|
|
|
9cb92d |
---
|
|
|
9cb92d |
src/tests/krb5_utils-tests.c | 121 -------------------------------------------
|
|
|
9cb92d |
1 file changed, 121 deletions(-)
|
|
|
9cb92d |
|
|
|
9cb92d |
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
|
|
|
9cb92d |
index 3e0c607a58b9ff0840a93867c1ad61cc5a2ae665..11fe1d749dccb5d367e3840ebc0a396b992bce2a 100644
|
|
|
9cb92d |
--- a/src/tests/krb5_utils-tests.c
|
|
|
9cb92d |
+++ b/src/tests/krb5_utils-tests.c
|
|
|
9cb92d |
@@ -91,124 +91,6 @@ static void check_dir(const char *dirname, uid_t uid, gid_t gid, mode_t mode)
|
|
|
9cb92d |
mode, (stat_buf.st_mode & ~S_IFMT));
|
|
|
9cb92d |
}
|
|
|
9cb92d |
|
|
|
9cb92d |
-START_TEST(test_pub_ccache_dir)
|
|
|
9cb92d |
-{
|
|
|
9cb92d |
- int ret;
|
|
|
9cb92d |
- char *cwd;
|
|
|
9cb92d |
- char *testpath;
|
|
|
9cb92d |
- char *dirname;
|
|
|
9cb92d |
- char *subdirname;
|
|
|
9cb92d |
- char *filename;
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- fail_unless(getuid() == 0, "This test must be run as root.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- cwd = getcwd(NULL, 0);
|
|
|
9cb92d |
- fail_unless(cwd != NULL, "getcwd failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- testpath = talloc_asprintf(tmp_ctx, "%s/%s", cwd, TESTS_PATH);
|
|
|
9cb92d |
- free(cwd);
|
|
|
9cb92d |
- fail_unless(testpath != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- dirname = talloc_asprintf(tmp_ctx, "%s/pub_ccdir", testpath);
|
|
|
9cb92d |
- fail_unless(dirname != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- subdirname = talloc_asprintf(tmp_ctx, "%s/subdir", dirname);
|
|
|
9cb92d |
- fail_unless(subdirname != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- filename = talloc_asprintf(tmp_ctx, "%s/ccfile", subdirname);
|
|
|
9cb92d |
- fail_unless(filename != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- ret = chmod(testpath, 0754);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "chmod failed.");
|
|
|
9cb92d |
- ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
|
|
|
9cb92d |
- fail_unless(ret == EINVAL, "sss_krb5_precreate_ccache does not return EINVAL "
|
|
|
9cb92d |
- "while x-bit is missing.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- ret = chmod(testpath, 0755);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "chmod failed.");
|
|
|
9cb92d |
- ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- check_dir(subdirname, 0, 0, 01777);
|
|
|
9cb92d |
- RMDIR(subdirname);
|
|
|
9cb92d |
- check_dir(dirname, 0, 0, 0755);
|
|
|
9cb92d |
- RMDIR(dirname);
|
|
|
9cb92d |
-}
|
|
|
9cb92d |
-END_TEST
|
|
|
9cb92d |
-
|
|
|
9cb92d |
-START_TEST(test_pub_ccache_dir_in_user_dir)
|
|
|
9cb92d |
-{
|
|
|
9cb92d |
- int ret;
|
|
|
9cb92d |
- char *cwd;
|
|
|
9cb92d |
- char *dirname;
|
|
|
9cb92d |
- char *subdirname;
|
|
|
9cb92d |
- char *filename;
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- fail_unless(getuid() == 0, "This test must be run as root.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- cwd = getcwd(NULL, 0);
|
|
|
9cb92d |
- fail_unless(cwd != NULL, "getcwd failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- dirname = talloc_asprintf(tmp_ctx, "%s/%s/pub_ccdir", cwd, TESTS_PATH);
|
|
|
9cb92d |
- free(cwd);
|
|
|
9cb92d |
- fail_unless(dirname != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- ret = mkdir(dirname, 0700);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "mkdir failed.\n");
|
|
|
9cb92d |
- ret = chown(dirname, 12345, 12345);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "chown failed.\n");
|
|
|
9cb92d |
- subdirname = talloc_asprintf(tmp_ctx, "%s/subdir", dirname);
|
|
|
9cb92d |
- fail_unless(subdirname != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- filename = talloc_asprintf(tmp_ctx, "%s/ccfile", subdirname);
|
|
|
9cb92d |
- fail_unless(filename != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
|
|
|
9cb92d |
- fail_unless(ret == EINVAL, "Creating public ccache dir in user dir "
|
|
|
9cb92d |
- "does not failed with EINVAL.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- RMDIR(dirname);
|
|
|
9cb92d |
-}
|
|
|
9cb92d |
-END_TEST
|
|
|
9cb92d |
-
|
|
|
9cb92d |
-START_TEST(test_priv_ccache_dir)
|
|
|
9cb92d |
-{
|
|
|
9cb92d |
- int ret;
|
|
|
9cb92d |
- char *cwd;
|
|
|
9cb92d |
- char *testpath;
|
|
|
9cb92d |
- char *dirname;
|
|
|
9cb92d |
- char *subdir;
|
|
|
9cb92d |
- char *filename;
|
|
|
9cb92d |
- uid_t uid = 12345;
|
|
|
9cb92d |
- gid_t gid = 12345;
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- fail_unless(getuid() == 0, "This test must be run as root.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- cwd = getcwd(NULL, 0);
|
|
|
9cb92d |
- fail_unless(cwd != NULL, "getcwd failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- testpath = talloc_asprintf(tmp_ctx, "%s/%s", cwd, TESTS_PATH);
|
|
|
9cb92d |
- free(cwd);
|
|
|
9cb92d |
- fail_unless(testpath != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- dirname = talloc_asprintf(tmp_ctx, "%s/base", testpath);
|
|
|
9cb92d |
- subdir = talloc_asprintf(tmp_ctx, "%s/priv_ccdir", dirname);
|
|
|
9cb92d |
- fail_unless(subdir != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
- filename = talloc_asprintf(tmp_ctx, "%s/ccfile", subdir);
|
|
|
9cb92d |
- fail_unless(filename != NULL, "talloc_asprintf failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- ret = chmod(testpath, 0754);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "chmod failed.");
|
|
|
9cb92d |
- ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
|
|
|
9cb92d |
- fail_unless(ret == EINVAL, "sss_krb5_precreate_ccache does not return EINVAL "
|
|
|
9cb92d |
- "while x-bit is missing.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- ret = chmod(testpath, 0755);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "chmod failed.");
|
|
|
9cb92d |
- ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
|
|
|
9cb92d |
- fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
|
|
|
9cb92d |
-
|
|
|
9cb92d |
- check_dir(subdir, uid, gid, 0700);
|
|
|
9cb92d |
- RMDIR(subdir);
|
|
|
9cb92d |
- check_dir(dirname, 0, 0, 0755);
|
|
|
9cb92d |
- RMDIR(dirname);
|
|
|
9cb92d |
-}
|
|
|
9cb92d |
-END_TEST
|
|
|
9cb92d |
-
|
|
|
9cb92d |
START_TEST(test_private_ccache_dir_in_user_dir)
|
|
|
9cb92d |
{
|
|
|
9cb92d |
int ret;
|
|
|
9cb92d |
@@ -736,10 +618,7 @@ Suite *krb5_utils_suite (void)
|
|
|
9cb92d |
tcase_add_test (tc_create_dir, test_illegal_patterns);
|
|
|
9cb92d |
tcase_add_test (tc_create_dir, test_cc_dir_create);
|
|
|
9cb92d |
if (getuid() == 0) {
|
|
|
9cb92d |
- tcase_add_test (tc_create_dir, test_priv_ccache_dir);
|
|
|
9cb92d |
tcase_add_test (tc_create_dir, test_private_ccache_dir_in_user_dir);
|
|
|
9cb92d |
- tcase_add_test (tc_create_dir, test_pub_ccache_dir);
|
|
|
9cb92d |
- tcase_add_test (tc_create_dir, test_pub_ccache_dir_in_user_dir);
|
|
|
9cb92d |
tcase_add_test (tc_create_dir, test_private_ccache_dir_in_wrong_user_dir);
|
|
|
9cb92d |
} else {
|
|
|
9cb92d |
printf("Run as root to enable more tests.\n");
|
|
|
9cb92d |
--
|
|
|
9cb92d |
1.9.0
|
|
|
9cb92d |
|