From f535e13fbb1cf3347975c7d5908293a1ca589497 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Thu, 10 Jun 2010 21:14:34 +0000 Subject: [PATCH] pull up r24123 from trunk ------------------------------------------------------------------------ r24123 | ghudson | 2010-06-08 14:18:03 -0400 (Tue, 08 Jun 2010) | 11 lines 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. ticket: 6740 version_fixed: 1.8.3 status: resolved git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-8@24131 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/cli/kadmin.h | 1 - src/kadmin/cli/keytab.c | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/kadmin/cli/kadmin.h b/src/kadmin/cli/kadmin.h index 5c9decc7d..9f657a646 100644 --- a/src/kadmin/cli/kadmin.h +++ b/src/kadmin/cli/kadmin.h @@ -68,7 +68,6 @@ extern time_t get_date(char *); /* Yucky global variables */ extern krb5_context context; -extern char *krb5_defkeyname; extern char *whoami; extern void *handle; diff --git a/src/kadmin/cli/keytab.c b/src/kadmin/cli/keytab.c index 8d14f860a..1f810324b 100644 --- a/src/kadmin/cli/keytab.c +++ b/src/kadmin/cli/keytab.c @@ -84,9 +84,7 @@ process_keytab(krb5_context my_context, char **keytab_str, 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 @@ process_keytab(krb5_context my_context, char **keytab_str, 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); -- 2.26.2