From: Greg Hudson Date: Tue, 8 Jun 2010 18:18:03 +0000 (+0000) Subject: kadmin ktadd may display wrong name of default keytab X-Git-Tag: krb5-1.9-beta1~198 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e948df8c7ba8174337437b47dd2de2c14e98e19f;p=krb5.git kadmin ktadd may display wrong name of default keytab 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 --- 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 8b291100e..3a7867f46 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);