------------------------------------------------------------------------
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
/* Yucky global variables */
extern krb5_context context;
-extern char *krb5_defkeyname;
extern char *whoami;
extern void *handle;
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;
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);