[SSSD] [PATCH] possible alternative for #2071

Jakub Hrozek jhrozek at redhat.com
Fri Oct 4 07:48:18 UTC 2013


On Tue, Oct 01, 2013 at 10:10:57PM +0200, Jakub Hrozek wrote:
> On Tue, Oct 01, 2013 at 09:50:07PM +0200, Jakub Hrozek wrote:
> > On Tue, Oct 01, 2013 at 09:45:37PM +0200, Jakub Hrozek wrote:
> > > On Thu, Sep 26, 2013 at 08:25:12PM +0200, Jakub Hrozek wrote:
> > > > On Wed, Sep 25, 2013 at 05:50:16PM -0400, Simo Sorce wrote:
> > > > > On Wed, 2013-09-25 at 17:37 -0400, Simo Sorce wrote:
> > > > > > On Tue, 2013-09-24 at 12:52 +0200, Jakub Hrozek wrote:
> > > > > > > On Fri, Sep 20, 2013 at 01:09:34PM -0400, Simo Sorce wrote:
> > > > > > > > On Mon, 2013-09-09 at 11:22 -0400, Simo Sorce wrote:
> > > > > > > > > On Mon, 2013-09-09 at 13:41 +0200, Jakub Hrozek wrote:
> > > > > > > > > > On Mon, Sep 09, 2013 at 01:25:30PM +0200, Sumit Bose wrote:
> > > > > > > > > > > On Tue, Sep 03, 2013 at 10:52:14PM -0400, Simo Sorce wrote:
> > > > > > > > > > > > Attached an untested possible alternative for #2071
> > > > > > > > > > > > 
> > > > > > > > > > > > The other option is the last patch of my previous patchset in the thread
> > > > > > > > > > > > named: "[SSSD] [PATCHES] Simplify credential krb5 cache manipulation".
> > > > > > > > > > > > 
> > > > > > > > > > > > Let's discuss if any of these  approaches is ok, or if a third way needs
> > > > > > > > > > > > to be found.
> > > > > > > > > > > > 
> > > > > > > > > > > > Simo.
> > > > > > > > > > > > 
> > > > > > > > > > > > -- 
> > > > > > > > > > > > Simo Sorce * Red Hat, Inc * New York
> > > > > > > > > > > 
> > > > > > > > > > > (a short summary of the two patches in discussion)
> > > > > > > > > > > The difference between the two approaches is that the patch in this
> > > > > > > > > > > tread just sets the permission on all newly created directories to
> > > > > > > > > > > "new_dir_mode = 0700" making them private by default. The patch in the
> > > > > > > > > > > other thread tries to improve the current scheme where SSSD tries to
> > > > > > > > > > > figure out which directory which must be created is a public or a
> > > > > > > > > > > private one and sets the mode accordingly.
> > > > > > > > > > > 
> > > > > > > > > > > I agree with 'Setting up public directories is the job of the admin' and
> > > > > > > > > > > like the fact that the patch is making the SSSD code much simpler. But I
> > > > > > > > > > > assume that there are SSSD setups in use which depend on the feature of
> > > > > > > > > > > creating the directories with the "right" permissions. I can imagine
> > > > > > > > > > > automatic installations e.g. with kickstart which does not create the
> > > > > > > > > > > needed directories but rely on SSSD to create them or installations
> > > > > > > > > > > where the credential caches are stored into some RAM based file system
> > > > > > > > > > > where directories must be recreated on every restart.  I do not want to
> > > > > > > > > > > discuss the correctness of those approaches or if the paths used to
> > > > > > > > > > > store the credential caches are chosen wisely my point is just that a
> > > > > > > > > > > change might break existing installations.
> > > > > > > > > > > 
> > > > > > > > > > > For this reason I would prefer to just improve the existing behaviour.
> > > > > > > > > > > But if a majority says that it is time for a change I will not argue
> > > > > > > > > > > against it.
> > > > > > > > > > > 
> > > > > > > > > > > bye,
> > > > > > > > > > > Sumit
> > > > > > > > > > 
> > > > > > > > > > That's a good point.
> > > > > > > > > > 
> > > > > > > > > > Could we get away with keeping the existing behaviour and printing a log
> > > > > > > > > > message whenever we create a public directory saying that this feature
> > > > > > > > > > might go away in a later release?
> > > > > > > > > 
> > > > > > > > > I do not really think it is a good point.
> > > > > > > > > A) I really do not think there is any user fo this feature, the only 2
> > > > > > > > > places where people put stuff today are /tmp (FILE or DIR) and /run/user
> > > > > > > > > (DIR).
> > > > > > > > > 
> > > > > > > > > /tmp is already set up correctly (if not many other things will break
> > > > > > > > > and SSSD should *not* mask the mess by creating the dir and further
> > > > > > > > > confusing the admin.
> > > > > > > > > /run/user is a private directory so making it public would be wrong.
> > > > > > > > > 
> > > > > > > > > I think a change of behavior is in the best interest of our community
> > > > > > > > > even if it ends up breaking 1 rare install that happened to know of this
> > > > > > > > > new behavior and intentionally used it.
> > > > > > > > 
> > > > > > > > Bump and attached find the 2 patches rebased both on top of my latest
> > > > > > > > patchset sent to the list earlier.
> > > > > > > > 
> > > > > > > > 0004 tries to maintain behavior, just saner.
> > > > > > > > 0001 is the option to remove it completely.
> > > > > > > 
> > > > > > > As agreed yesterday on a call, we're going to remove the option
> > > > > > > completely. The patch no longer applies cleanly, not even with a 3-way
> > > > > > > merge. I had to apply it with patch(1), so can you please re-send? One
> > > > > > > minor comment inline:
> > > > > > 
> > > > > > It doesn't apply because, it depends on the patch from the other
> > > > > > patchset that you did not apply ("krb5: Improve ccache name checks")
> > > > > 
> > > > > Ok fixed the issues and rebase before the other patch, should apply
> > > > > cleanly on master now.
> > > > > 
> > > > > Simo.
> > > > > 
> > > > > -- 
> > > > > Simo Sorce * Red Hat, Inc * New York
> > > > 
> > > > There still must be some patch missing in between, I can't compile this
> > > > version:
> > > > 
> > > >   CC       src/providers/krb5/krb5_init_shared.lo
> > > > /home/remote/jhrozek/devel/sssd/src/providers/krb5/krb5_auth.c:295:17: warning: unused variable 'realm' [-Wunused-variable]
> > > >     const char *realm;
> > > >                 ^
> > > > 2 warnings generated.
> > > > /home/remote/jhrozek/devel/sssd/src/tests/krb5_child-test.c:249:57: error: too many arguments to function call, expected 5, have 6
> > > >                                             true, true, &private);
> > > >                                                         ^~~~~~~~
> > > > /home/remote/jhrozek/devel/sssd/src/providers/krb5/krb5_utils.h:48:1: note: 'expand_ccname_template' declared here
> > > > char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
> > > > ^
> > > > /home/remote/jhrozek/devel/sssd/src/tests/krb5_child-test.c:265:55: error: too many arguments to function call, expected 4, have 5
> > > >                                     kr->uid, kr->gid, private);
> > > >                                                       ^~~~~~~
> > > 
> > > Ugh, I must have misapplied the patch. Now everything seems to have
> > > applied and built correctly. My initial testing also passed.
> > > 
> > > ACK
> > 
> > I will just squash in the following change before pushing:
> > diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c
> > index a16b539..a4183dc 100644
> > --- a/src/providers/krb5/krb5_auth.c
> > +++ b/src/providers/krb5/krb5_auth.c
> > @@ -292,7 +292,6 @@ static errno_t krb5_auth_prepare_ccache_name(struct krb5child_req *kr,
> >                                               struct be_ctx *be_ctx)
> >  {
> >      const char *ccname_template;
> > -    const char *realm;
> >      errno_t ret;
> >  
> >      if (!kr->is_offline) {
> 
> Sorry for talking to myself, but I have to nack the patch after all, the
> unit tests are not passing.

I'd like to apply the attached patch on top of yours.
-------------- next part --------------
>From adf0fd14ea54a3b015efe8a6d67532b87a064cdd Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 4 Oct 2013 09:40:34 +0200
Subject: [PATCH] krb5: Fix unit tests

---
 src/tests/krb5_child-test.c  |   5 +-
 src/tests/krb5_utils-tests.c | 126 +++++++++++++++----------------------------
 2 files changed, 46 insertions(+), 85 deletions(-)

diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c
index 959b1bd698284d0db16634357e39fcd076b9fa00..0c6b68b82c648b8e83f5d11b613dd57be89482a0 100644
--- a/src/tests/krb5_child-test.c
+++ b/src/tests/krb5_child-test.c
@@ -198,7 +198,6 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user,
 {
     struct krb5child_req *kr;
     struct passwd *pwd;
-    bool private = false;
     errno_t ret;
 
     /* The top level child request */
@@ -246,7 +245,7 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user,
         kr->ccname = expand_ccname_template(kr, kr,
                                         dp_opt_get_cstring(kr->krb5_ctx->opts,
                                                            KRB5_CCNAME_TMPL),
-                                            true, true, &private);
+                                            true, true);
         if (!kr->ccname) goto fail;
 
         DEBUG(SSSDBG_FUNC_DATA, ("ccname [%s] uid [%llu] gid [%llu]\n",
@@ -262,7 +261,7 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user,
 
     ret = sss_krb5_precreate_ccache(kr->ccname,
                                     kr->krb5_ctx->illegal_path_re,
-                                    kr->uid, kr->gid, private);
+                                    kr->uid, kr->gid);
     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 ea0292569135e0fc22a44251cfc4e8719a15837f..3e0c607a58b9ff0840a93867c1ad61cc5a2ae665 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -117,13 +117,13 @@ START_TEST(test_pub_ccache_dir)
 
     ret = chmod(testpath, 0754);
     fail_unless(ret == EOK, "chmod failed.");
-    ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
+    ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
     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 = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
+    ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
     fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
 
     check_dir(subdirname, 0, 0, 01777);
@@ -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 = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, false);
+    ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
     fail_unless(ret == EINVAL, "Creating public ccache dir in user dir "
                                "does not failed with EINVAL.");
 
@@ -193,13 +193,13 @@ START_TEST(test_priv_ccache_dir)
 
     ret = chmod(testpath, 0754);
     fail_unless(ret == EOK, "chmod failed.");
-    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
     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 = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
     fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
 
     check_dir(subdir, uid, gid, 0700);
@@ -248,13 +248,13 @@ START_TEST(test_private_ccache_dir_in_user_dir)
 
     ret = chmod(user_dir, 0600);
     fail_unless(ret == EOK, "chmod failed.");
-    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
     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 = sss_krb5_precreate_ccache(filename, NULL, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(filename, NULL, uid, gid);
     fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed.");
 
     check_dir(dn3, uid, gid, 0700);
@@ -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 = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345, true);
+    ret = sss_krb5_precreate_ccache(filename, NULL, 12345, 12345);
     fail_unless(ret == EINVAL, "Creating private ccache dir in wrong user "
                                "dir does not failed with EINVAL.");
 
@@ -329,27 +329,27 @@ START_TEST(test_illegal_patterns)
 
     filename = talloc_asprintf(tmp_ctx, "abc/./ccfile");
     fail_unless(filename != NULL, "talloc_asprintf failed.");
-    ret = create_ccache_dir(filename, illegal_re, uid, gid, true);
+    ret = create_ccache_dir(filename, illegal_re, uid, gid);
     fail_unless(ret == EINVAL, "create_ccache_dir allowed relative path [%s].",
                                filename);
 
     filename = talloc_asprintf(tmp_ctx, "%s/abc/./ccfile", dirname);
     fail_unless(filename != NULL, "talloc_asprintf failed.");
-    ret = create_ccache_dir(filename, illegal_re, uid, gid, true);
+    ret = create_ccache_dir(filename, illegal_re, uid, gid);
     fail_unless(ret == EINVAL, "create_ccache_dir allowed "
                                "illegal pattern '/./' in filename [%s].",
                                filename);
 
     filename = talloc_asprintf(tmp_ctx, "%s/abc/../ccfile", dirname);
     fail_unless(filename != NULL, "talloc_asprintf failed.");
-    ret = create_ccache_dir(filename, illegal_re, uid, gid, true);
+    ret = create_ccache_dir(filename, illegal_re, uid, gid);
     fail_unless(ret == EINVAL, "create_ccache_dir allowed "
                                "illegal pattern '/../' in filename [%s].",
                                filename);
 
     filename = talloc_asprintf(tmp_ctx, "%s/abc//ccfile", dirname);
     fail_unless(filename != NULL, "talloc_asprintf failed.");
-    ret = create_ccache_dir(filename, illegal_re, uid, gid, true);
+    ret = create_ccache_dir(filename, illegal_re, uid, gid);
     fail_unless(ret == EINVAL, "create_ccache_dir allowed "
                                "illegal pattern '//' in filename [%s].",
                                filename);
@@ -385,7 +385,7 @@ START_TEST(test_cc_dir_create)
     residual = talloc_asprintf(tmp_ctx, "DIR:%s/%s", dirname, "ccdir");
     fail_unless(residual != NULL, "talloc_asprintf failed.");
 
-    ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid);
     fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed\n");
     ret = rmdir(dirname);
     if (ret < 0) ret = errno;
@@ -398,7 +398,7 @@ START_TEST(test_cc_dir_create)
     residual = talloc_asprintf(tmp_ctx, "DIR:%s/%s", dirname, "ccdir/");
     fail_unless(residual != NULL, "talloc_asprintf failed.");
 
-    ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid, true);
+    ret = sss_krb5_precreate_ccache(residual, illegal_re, uid, gid);
     fail_unless(ret == EOK, "sss_krb5_precreate_ccache failed\n");
     ret = rmdir(dirname);
     if (ret < 0) ret = errno;
@@ -463,40 +463,34 @@ void free_talloc_context(void)
 }
 
 static void do_test(const char *file_template, const char *dir_template,
-                    const char *expected, const bool expected_private_path)
+                    const char *expected)
 {
     char *result;
     int ret;
-    bool private_path = false;
 
     ret = dp_opt_set_string(kr->krb5_ctx->opts, KRB5_CCACHEDIR, dir_template);
     fail_unless(ret == EOK, "Failed to set Ccache dir");
 
-    result = expand_ccname_template(tmp_ctx, kr, file_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, file_template, true, true);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", file_template);
     fail_unless(strcmp(result, expected) == 0,
                 "Expansion failed, result [%s], expected [%s].",
                 result, expected);
-    fail_unless(private_path == expected_private_path,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false",
-                expected_private_path ? "true" : "false");
 }
 
 START_TEST(test_multiple_substitutions)
 {
-    do_test(BASE"_%u_%U_%u", CCACHE_DIR, BASE"_"USERNAME"_"UID"_"USERNAME, false);
+    do_test(BASE"_%u_%U_%u", CCACHE_DIR, BASE"_"USERNAME"_"UID"_"USERNAME);
     do_test("%d/"FILENAME, BASE"_%u_%U_%u",
-            BASE"_"USERNAME"_"UID"_"USERNAME"/"FILENAME, true);
+            BASE"_"USERNAME"_"UID"_"USERNAME"/"FILENAME);
 }
 END_TEST
 
 START_TEST(test_username)
 {
-    do_test(BASE"_%u", CCACHE_DIR, BASE"_"USERNAME, false);
-    do_test("%d/"FILENAME, BASE"_%u", BASE"_"USERNAME"/"FILENAME, true);
+    do_test(BASE"_%u", CCACHE_DIR, BASE"_"USERNAME);
+    do_test("%d/"FILENAME, BASE"_%u", BASE"_"USERNAME"/"FILENAME);
 }
 END_TEST
 
@@ -504,7 +498,6 @@ START_TEST(test_case_sensitive)
 {
     char *result;
     int ret;
-    bool private_path = false;
     const char *file_template = BASE"_%u";
     const char *expected_cs = BASE"_TestUser";
     const char *expected_ci = BASE"_testuser";
@@ -513,16 +506,14 @@ START_TEST(test_case_sensitive)
     ret = dp_opt_set_string(kr->krb5_ctx->opts, KRB5_CCACHEDIR, CCACHE_DIR);
     fail_unless(ret == EOK, "Failed to set Ccache dir");
 
-    result = expand_ccname_template(tmp_ctx, kr, file_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, file_template, true, true);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", file_template);
     fail_unless(strcmp(result, expected_cs) == 0,
                 "Expansion failed, result [%s], expected [%s].",
                 result, expected_cs);
 
-    result = expand_ccname_template(tmp_ctx, kr, file_template, true,
-                                    false, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, file_template, true, false);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", file_template);
     fail_unless(strcmp(result, expected_ci) == 0,
@@ -533,29 +524,29 @@ END_TEST
 
 START_TEST(test_uid)
 {
-    do_test(BASE"_%U", CCACHE_DIR, BASE"_"UID, false);
-    do_test("%d/"FILENAME, BASE"_%U", BASE"_"UID"/"FILENAME, true);
+    do_test(BASE"_%U", CCACHE_DIR, BASE"_"UID);
+    do_test("%d/"FILENAME, BASE"_%U", BASE"_"UID"/"FILENAME);
 }
 END_TEST
 
 START_TEST(test_upn)
 {
-    do_test(BASE"_%p", CCACHE_DIR, BASE"_"PRINCIPAL_NAME, false);
-    do_test("%d/"FILENAME, BASE"_%p", BASE"_"PRINCIPAL_NAME"/"FILENAME, true);
+    do_test(BASE"_%p", CCACHE_DIR, BASE"_"PRINCIPAL_NAME);
+    do_test("%d/"FILENAME, BASE"_%p", BASE"_"PRINCIPAL_NAME"/"FILENAME);
 }
 END_TEST
 
 START_TEST(test_realm)
 {
-    do_test(BASE"_%r", CCACHE_DIR, BASE"_"REALM, false);
-    do_test("%d/"FILENAME, BASE"_%r", BASE"_"REALM"/"FILENAME, false);
+    do_test(BASE"_%r", CCACHE_DIR, BASE"_"REALM);
+    do_test("%d/"FILENAME, BASE"_%r", BASE"_"REALM"/"FILENAME);
 }
 END_TEST
 
 START_TEST(test_home)
 {
-    do_test(BASE"_%h", CCACHE_DIR, BASE"_"HOME_DIRECTORY, false);
-    do_test("%d/"FILENAME, BASE"_%h", BASE"_"HOME_DIRECTORY"/"FILENAME, true);
+    do_test(BASE"_%h", CCACHE_DIR, BASE"_"HOME_DIRECTORY);
+    do_test("%d/"FILENAME, BASE"_%h", BASE"_"HOME_DIRECTORY"/"FILENAME);
 }
 END_TEST
 
@@ -563,20 +554,15 @@ START_TEST(test_ccache_dir)
 {
     char *result;
     int ret;
-    bool private_path = false;
 
-    do_test(BASE"_%d", CCACHE_DIR, BASE"_"CCACHE_DIR, false);
+    do_test(BASE"_%d", CCACHE_DIR, BASE"_"CCACHE_DIR);
 
     ret = dp_opt_set_string(kr->krb5_ctx->opts, KRB5_CCACHEDIR, BASE"_%d");
     fail_unless(ret == EOK, "Failed to set Ccache dir");
 
-    result = expand_ccname_template(tmp_ctx, kr, "%d/"FILENAME, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, "%d/"FILENAME, true, true);
 
     fail_unless(result == NULL, "Using %%d in ccache dir should fail.");
-    fail_unless(private_path == false,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false", "false");
 }
 END_TEST
 
@@ -584,39 +570,32 @@ START_TEST(test_pid)
 {
     char *result;
     int ret;
-    bool private_path = false;
 
-    do_test(BASE"_%P", CCACHE_DIR, BASE"_"PID, false);
+    do_test(BASE"_%P", CCACHE_DIR, BASE"_"PID);
 
     ret = dp_opt_set_string(kr->krb5_ctx->opts, KRB5_CCACHEDIR, BASE"_%P");
     fail_unless(ret == EOK, "Failed to set Ccache dir");
 
-    result = expand_ccname_template(tmp_ctx, kr, "%d/"FILENAME, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, "%d/"FILENAME, true, true);
 
     fail_unless(result == NULL, "Using %%P in ccache dir should fail.");
-    fail_unless(private_path == false,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false", "false");
 }
 END_TEST
 
 START_TEST(test_percent)
 {
-    do_test(BASE"_%%", CCACHE_DIR, BASE"_%", false);
-    do_test("%d/"FILENAME, BASE"_%%", BASE"_%/"FILENAME, false);
+    do_test(BASE"_%%", CCACHE_DIR, BASE"_%");
+    do_test("%d/"FILENAME, BASE"_%%", BASE"_%/"FILENAME);
 }
 END_TEST
 
-START_TEST(test_unknow_template)
+START_TEST(test_unknown_template)
 {
     const char *test_template = BASE"_%X";
     char *result;
     int ret;
-    bool private_path = false;
 
-    result = expand_ccname_template(tmp_ctx, kr, test_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, test_template, true, true);
 
     fail_unless(result == NULL, "Unknown template [%s] should fail.",
                 test_template);
@@ -624,14 +603,10 @@ START_TEST(test_unknow_template)
     ret = dp_opt_set_string(kr->krb5_ctx->opts, KRB5_CCACHEDIR, BASE"_%X");
     fail_unless(ret == EOK, "Failed to set Ccache dir");
     test_template = "%d/"FILENAME;
-    result = expand_ccname_template(tmp_ctx, kr, test_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, test_template, true, true);
 
     fail_unless(result == NULL, "Unknown template [%s] should fail.",
                 test_template);
-    fail_unless(private_path == false,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false", "false");
 }
 END_TEST
 
@@ -639,16 +614,11 @@ START_TEST(test_NULL)
 {
     char *test_template = NULL;
     char *result;
-    bool private_path = false;
 
-    result = expand_ccname_template(tmp_ctx, kr, test_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, test_template, true, true);
 
     fail_unless(result == NULL, "Expected NULL as a result for an empty input.",
                 test_template);
-    fail_unless(private_path == false,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false", "false");
 }
 END_TEST
 
@@ -656,32 +626,25 @@ START_TEST(test_no_substitution)
 {
     const char *test_template = BASE;
     char *result;
-    bool private_path = false;
 
-    result = expand_ccname_template(tmp_ctx, kr, test_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, test_template, true, true);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", test_template);
     fail_unless(strcmp(result, test_template) == 0,
                 "Expansion failed, result [%s], expected [%s].",
                 result, test_template);
-    fail_unless(private_path == false,
-                "Unexpected private path, get [%s], expected [%s].",
-                private_path ? "true" : "false", "false");
 }
 END_TEST
 
 START_TEST(test_krb5_style_expansion)
 {
     char *result;
-    bool private_path = false;
     const char *file_template;
     const char *expected;
 
     file_template = BASE"/%{uid}/%{USERID}/%{euid}/%{username}";
     expected = BASE"/"UID"/"UID"/"UID"/"USERNAME;
-    result = expand_ccname_template(tmp_ctx, kr, file_template, true,
-                                    true, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, file_template, true, true);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", file_template);
     fail_unless(strcmp(result, expected) == 0,
@@ -690,8 +653,7 @@ START_TEST(test_krb5_style_expansion)
 
     file_template = BASE"/%{unknown}";
     expected = BASE"/%{unknown}";
-    result = expand_ccname_template(tmp_ctx, kr, file_template, true,
-                                    false, &private_path);
+    result = expand_ccname_template(tmp_ctx, kr, file_template, true, false);
 
     fail_unless(result != NULL, "Cannot expand template [%s].", file_template);
     fail_unless(strcmp(result, expected) == 0,
@@ -754,7 +716,7 @@ Suite *krb5_utils_suite (void)
                                free_talloc_context);
     tcase_add_test (tc_ccname_template, test_no_substitution);
     tcase_add_test (tc_ccname_template, test_NULL);
-    tcase_add_test (tc_ccname_template, test_unknow_template);
+    tcase_add_test (tc_ccname_template, test_unknown_template);
     tcase_add_test (tc_ccname_template, test_username);
     tcase_add_test (tc_ccname_template, test_case_sensitive);
     tcase_add_test (tc_ccname_template, test_uid);
-- 
1.8.3.1



More information about the sssd-devel mailing list