svn rev #24123: trunk/src/kadmin/cli/

ghudson@MIT.EDU ghudson at MIT.EDU
Tue Jun 8 14:18:03 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24123
Commit By: ghudson
Log Message:
ticket: 6740
subject: kadmin ktadd may display wrong name of default keytab
target_version: 1.8.2
tags: pullup

kadmin's ktadd (and ktrem) displays WRFILE:/etc/krb5.keytab whenever
it uses the default keytab, even if the default has been overridden
(e.g. by KRB5_KTNAME).  Use krb5_kt_get_name to get the correct name
of the default cache instead of displaying the string we think was
used to open it.



Changed Files:
U   trunk/src/kadmin/cli/kadmin.h
U   trunk/src/kadmin/cli/keytab.c
Modified: trunk/src/kadmin/cli/kadmin.h
===================================================================
--- trunk/src/kadmin/cli/kadmin.h	2010-06-08 17:53:19 UTC (rev 24122)
+++ trunk/src/kadmin/cli/kadmin.h	2010-06-08 18:18:03 UTC (rev 24123)
@@ -68,7 +68,6 @@
 
 /* Yucky global variables */
 extern krb5_context context;
-extern char *krb5_defkeyname;
 extern char *whoami;
 extern void *handle;
 

Modified: trunk/src/kadmin/cli/keytab.c
===================================================================
--- trunk/src/kadmin/cli/keytab.c	2010-06-08 17:53:19 UTC (rev 24122)
+++ trunk/src/kadmin/cli/keytab.c	2010-06-08 18:18:03 UTC (rev 24123)
@@ -84,9 +84,7 @@
     char *name = *keytab_str;
 
     if (name == NULL) {
-        /* XXX krb5_defkeyname is an internal library global and
-           should go away */
-        name = strdup(krb5_defkeyname);
+        name = malloc(BUFSIZ);
         if (!name) {
             com_err(whoami, ENOMEM, "while creating keytab name");
             return 1;
@@ -97,6 +95,12 @@
             free(name);
             return 1;
         }
+        code = krb5_kt_get_name(my_context, *keytab, name, BUFSIZ);
+        if (code != 0) {
+            com_err(whoami, code, "while getting keytab name");
+            free(name);
+            return 1;
+        }
     } else {
         if (strchr(name, ':') != NULL)
             name = strdup(name);




More information about the cvs-krb5 mailing list