summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/krb5_child-test.c6
-rw-r--r--src/tests/krb5_utils-tests.c40
2 files changed, 21 insertions, 25 deletions
diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c
index dff62ab6..5ea30014 100644
--- a/src/tests/krb5_child-test.c
+++ b/src/tests/krb5_child-test.c
@@ -287,9 +287,9 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user,
DEBUG(SSSDBG_FUNC_DATA, ("ccname [%s] uid [%llu] gid [%llu]\n",
kr->ccname, kr->uid, kr->gid));
- ret = kr->krb5_ctx->cc_be->create(kr->ccname,
- kr->krb5_ctx->illegal_path_re,
- kr->uid, kr->gid, private);
+ ret = sss_krb5_precreate_ccache(kr->ccname,
+ kr->krb5_ctx->illegal_path_re,
+ kr->uid, kr->gid, private);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("create_ccache_dir failed.\n"));
goto fail;
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
index 4715774f..ea029256 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -117,14 +117,14 @@ START_TEST(test_pub_ccache_dir)
ret = chmod(testpath, 0754);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, 12345, 12345, false);
- fail_unless(ret == EINVAL, "cc_file_create does not return EINVAL "
+ ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
+ fail_unless(ret == EINVAL, "sss_krb5_precreate_ccache does not return EINVAL "
"while x-bit is missing.");
ret = chmod(testpath, 0755);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, 12345, 12345, false);
- fail_unless(ret == EOK, "cc_file_create failed.");
+ ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
+ fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
check_dir(subdirname, 0, 0, 01777);
RMDIR(subdirname);
@@ -158,7 +158,7 @@ START_TEST(test_pub_ccache_dir_in_user_dir)
filename = talloc_asprintf(tmp_ctx, "%s/ccfile", subdirname);
fail_unless(filename != NULL, "talloc_asprintf failed.");
- ret = cc_file_create(filename, NULL, 12345, 12345, false);
+ ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
fail_unless(ret == EINVAL, "Creating public ccache dir in user dir "
"does not failed with EINVAL.");
@@ -193,14 +193,14 @@ START_TEST(test_priv_ccache_dir)
ret = chmod(testpath, 0754);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, uid, gid, true);
- fail_unless(ret == EINVAL, "cc_file_create does not return EINVAL "
+ ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+ fail_unless(ret == EINVAL, "sss_krb5_precreate_ccache does not return EINVAL "
"while x-bit is missing.");
ret = chmod(testpath, 0755);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, uid, gid, true);
- fail_unless(ret == EOK, "cc_file_create failed.");
+ ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+ fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
check_dir(subdir, uid, gid, 0700);
RMDIR(subdir);
@@ -248,14 +248,14 @@ START_TEST(test_private_ccache_dir_in_user_dir)
ret = chmod(user_dir, 0600);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, uid, gid, true);
- fail_unless(ret == EINVAL, "cc_file_create does not return EINVAL "
+ ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+ fail_unless(ret == EINVAL, "sss_krb5_precreate_ccache does not return EINVAL "
"while x-bit is missing.");
ret = chmod(user_dir, 0700);
fail_unless(ret == EOK, "chmod failed.");
- ret = cc_file_create(filename, NULL, uid, gid, true);
- fail_unless(ret == EOK, "cc_file_create failed.");
+ ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+ fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
check_dir(dn3, uid, gid, 0700);
RMDIR(dn3);
@@ -292,7 +292,7 @@ START_TEST(test_private_ccache_dir_in_wrong_user_dir)
filename = talloc_asprintf(tmp_ctx, "%s/ccfile", subdirname);
fail_unless(filename != NULL, "talloc_asprintf failed.");
- ret = cc_file_create(filename, NULL, 12345, 12345, true);
+ ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, true);
fail_unless(ret == EINVAL, "Creating private ccache dir in wrong user "
"dir does not failed with EINVAL.");
@@ -357,7 +357,6 @@ START_TEST(test_illegal_patterns)
}
END_TEST
-#ifdef HAVE_KRB5_CC_COLLECTION
START_TEST(test_cc_dir_create)
{
char *residual;
@@ -386,8 +385,8 @@ START_TEST(test_cc_dir_create)
residual = talloc_asprintf(tmp_ctx, "DIR:%s/%s", dirname, "ccdir");
fail_unless(residual != NULL, "talloc_asprintf failed.");
- ret = cc_dir_create(residual, illegal_re, uid, gid, true);
- fail_unless(ret == EOK, "cc_dir_create failed\n");
+ ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid, true);
+ fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed\n");
ret = rmdir(dirname);
if (ret < 0) ret = errno;
fail_unless(ret == 0, "Cannot remove %s: %s\n", dirname, strerror(ret));
@@ -399,8 +398,8 @@ START_TEST(test_cc_dir_create)
residual = talloc_asprintf(tmp_ctx, "DIR:%s/%s", dirname, "ccdir/");
fail_unless(residual != NULL, "talloc_asprintf failed.");
- ret = cc_dir_create(residual, illegal_re, uid, gid, true);
- fail_unless(ret == EOK, "cc_dir_create failed\n");
+ ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid, true);
+ fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed\n");
ret = rmdir(dirname);
if (ret < 0) ret = errno;
fail_unless(ret == 0, "Cannot remove %s: %s\n", dirname, strerror(ret));
@@ -408,7 +407,6 @@ START_TEST(test_cc_dir_create)
free(cwd);
}
END_TEST
-#endif /* HAVE_KRB5_CC_COLLECTION */
void setup_talloc_context(void)
@@ -774,9 +772,7 @@ Suite *krb5_utils_suite (void)
tcase_add_checked_fixture (tc_create_dir, setup_create_dir,
teardown_create_dir);
tcase_add_test (tc_create_dir, test_illegal_patterns);
-#ifdef HAVE_KRB5_CC_COLLECTION
tcase_add_test (tc_create_dir, test_cc_dir_create);
-#endif /* HAVE_KRB5_CC_COLLECTION */
if (getuid() == 0) {
tcase_add_test (tc_create_dir, test_priv_ccache_dir);
tcase_add_test (tc_create_dir, test_private_ccache_dir_in_user_dir);