]> eyrie.org Git - kerberos/kstart.git/commitdiff
Always canonicalize the ticket cache name in k5start
authorRuss Allbery <rra@stanford.edu>
Thu, 29 Dec 2011 22:16:08 +0000 (14:16 -0800)
committerRuss Allbery <rra@stanford.edu>
Thu, 29 Dec 2011 22:16:08 +0000 (14:16 -0800)
Always canonicalize the ticket cache name in k5start before
propagating KRB5CCNAME to child processes.  This combined with the
previous change allows -k to specify a ticket cache name that changes
once the cache is created, such as when creating new PIPE caches.

NEWS
k5start.c

diff --git a/NEWS b/NEWS
index 38a8ff4f9a67b551e7f0782e61cba6694e272cfd..d58eb8f959c325c5366a25890952fc67dc736979 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,11 @@ kstart 4.0 (unreleased)
     explicitly to the -k argument if they want the ticket cache to be set
     in the environment with that prefix.
 
+    Always canonicalize the ticket cache name in k5start before
+    propagating KRB5CCNAME to child processes.  This combined with the
+    previous change allows -k to specify a ticket cache name that changes
+    once the cache is created, such as when creating new PIPE caches.
+
     krenew now defaults to staying running if renewing credentials fails.
     The new -x option restores the previous behavior of exiting on any
     error.  It will still exit by default (unless -i is used) if the
index ccc28b3d084946a293c43dded374ba511c5c9cc8..721396757b6758b5182c12e7a35b52e2a8ae7632 100644 (file)
--- a/k5start.c
+++ b/k5start.c
@@ -569,19 +569,20 @@ main(int argc, char *argv[])
         free(tmp);
         config.cache = cache;
         config.clean_cache = true;
-    }
-    if (config.cache == NULL) {
+    } else {
         krb5_ccache ccache;
 
-        code = krb5_cc_default(ctx, &ccache);
+        if (config.cache == NULL)
+            code = krb5_cc_default(ctx, &ccache);
+        else
+            code = krb5_cc_resolve(ctx, config.cache, &ccache);
         if (code != 0)
-            die_krb5(ctx, code, "error opening default ticket cache");
+            die_krb5(ctx, code, "error opening ticket cache");
         config.cache = xstrdup(krb5_cc_get_name(ctx, ccache));
         krb5_cc_close(ctx, ccache);
-    } else {
-        if (setenv("KRB5CCNAME", config.cache, 1) != 0)
-            die("cannot set KRB5CCNAME environment variable");
     }
+    if (setenv("KRB5CCNAME", config.cache, 1) != 0)
+        die("cannot set KRB5CCNAME environment variable");
     if (private.set_perms)
         config.cache = strip_cache_prefix(config.cache);