krb5_kt_default_name() to avoid global variable nastiness.
* kadmin.c (kadmin_startup): Use krb5_kt_set_default_name to
change the default keytab name rather than assigning to a library
global variable.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9394
dc483132-0cff-0310-8789-
dd5450dbe970
+Tue Nov 12 22:05:26 1996 Tom Yu <tlyu@mit.edu>
+
+ * keytab.c (process_keytab): Retrieve *keytab_str using
+ krb5_kt_default_name() to avoid global variable nastiness.
+
+ * kadmin.c (kadmin_startup): Use krb5_kt_set_default_name to
+ change the default keytab name rather than assigning to a library
+ global variable.
+
Thu Nov 7 20:52:39 1996 Tom Yu <tlyu@mit.edu>
* configure.in: Remove spurious WITH_CCOPTS and KRB_INCLUDE.
exit(1);
}
{
-#define DEFAULT_KEYTAB "WRFILE:/etc/v5srvtab"
- extern char *krb5_defkeyname;
- krb5_defkeyname = DEFAULT_KEYTAB;
+ /* hack up the default keytab name to begin with "WRFILE:" */
+ char *cp, ktdef[BUFSIZ];
+ if ((retval = krb5_kt_default_name(context, ktdef, BUFSIZ))) {
+ com_err(whoami, retval, "while looking up default keytab name");
+ exit(1);
+ }
+ if ((cp = malloc(strlen(ktdef) + 1 + 2)) == NULL) {
+ com_err(whoami, ENOMEM, "while editting default keytab name");
+ exit(1);
+ }
+ strcpy(cp, "WR");
+ strcat(cp, ktdef);
+ if ((retval = krb5_kt_set_default_name(context, cp))) {
+ com_err(whoami, retval,
+ "while changing default keytab name");
+ exit(1);
+ }
+ free(cp);
}
return query;
*princ_str, char *kvno_str);
static char *etype_string(krb5_enctype enctype);
-extern char *krb5_defkeyname;
extern char *whoami;
extern krb5_context context;
extern void *handle;
int code;
if (*keytab_str == NULL) {
- if (! (*keytab_str = strdup(krb5_defkeyname))) {
- com_err(whoami, ENOMEM, "while creating keytab name");
+ char *keytab_str = malloc(BUFSIZ);
+
+ if (keytab_str == NULL) {
+ com_err(whoami, ENOMEM, "while creating default keytab name");
+ return 1;
+ }
+ if ((code = krb5_kt_default_name(context, keytab_str, BUFSIZ))) {
+ com_err(whoami, code, "while copying default keytab name");
+ free(*keytab_str);
return 1;
}
code = krb5_kt_default(context, keytab);