[28568] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: In ksu, handle typeless default_ccache_name values

daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Sep 8 14:55:16 2014

Date: Mon, 8 Sep 2014 14:55:07 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201409081855.s88It7xM021542@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/bda574576a5a2d0613fecf12d820e0adcbedf95c
commit bda574576a5a2d0613fecf12d820e0adcbedf95c
Author: Nalin Dahyabhai <nalin@redhat.com>
Date:   Mon Sep 8 13:15:40 2014 -0400

    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]
    
    ticket: 8007 (new)
    target_version: 1.13
    tags: pullup

 src/clients/ksu/main.c |   11 +++++++++--
 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;
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post