aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2014-09-08 13:15:40 -0400
committerTom Yu <tlyu@mit.edu>2014-09-10 14:16:53 -0400
commit1825e3a407db03b1e00aad148a4dc96d6a67a912 (patch)
tree769092aef61e2f8358c5af9570b8af878398b505
parente56c0064823778affabc60f94e4b59c486448e2c (diff)
downloadkrb5-1825e3a407db03b1e00aad148a4dc96d6a67a912.zip
krb5-1825e3a407db03b1e00aad148a4dc96d6a67a912.tar.gz
krb5-1825e3a407db03b1e00aad148a4dc96d6a67a912.tar.bz2
In ksu, handle typeless default_ccache_name values
When a configured or compiled-in default ccache name doesn't contain a cache type and ':' as a prefix, add one to the writeable value that we construct when we go to look it up. This lets the rest of the application always assume that it'll be there. [ghudson@mit.edu: minor style changes] (cherry picked from commit bda574576a5a2d0613fecf12d820e0adcbedf95c) ticket: 8007 version_fixed: 1.13 status: resolved
-rw-r--r--src/clients/ksu/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c
index 47fa820..622c36a 100644
--- a/src/clients/ksu/main.c
+++ b/src/clients/ksu/main.c
@@ -819,7 +819,7 @@ get_configured_defccname(krb5_context context, char **target_out)
{
krb5_error_code retval;
const char *defname;
- char *target;
+ char *target = NULL;
*target_out = NULL;
@@ -838,7 +838,14 @@ get_configured_defccname(krb5_context context, char **target_out)
}
defname = krb5_cc_default_name(context);
- target = (defname == NULL) ? NULL : strdup(defname);
+ if (defname != NULL) {
+ if (strchr(defname, ':') != NULL) {
+ target = strdup(defname);
+ } else {
+ if (asprintf(&target, "FILE:%s", defname) < 0)
+ target = NULL;
+ }
+ }
if (target == NULL) {
com_err(prog_name, ENOMEM, _("while determining target ccache name"));
return ENOMEM;