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
target_version: 1.8.2
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24123
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);