diff options
author | Tom Yu <tlyu@mit.edu> | 1996-11-13 03:35:50 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 1996-11-13 03:35:50 +0000 |
commit | 83721dc828e9b018f532ddba3ef240c39b65741f (patch) | |
tree | b2a2ec4e0ae93558f05d266441a79e6d46399d53 | |
parent | efd599df7705ff16ab16eef35eb760210f541c19 (diff) | |
download | krb5-83721dc828e9b018f532ddba3ef240c39b65741f.zip krb5-83721dc828e9b018f532ddba3ef240c39b65741f.tar.gz krb5-83721dc828e9b018f532ddba3ef240c39b65741f.tar.bz2 |
* 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.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9394 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/kadmin/cli/ChangeLog | 9 | ||||
-rw-r--r-- | src/kadmin/cli/kadmin.c | 21 | ||||
-rw-r--r-- | src/kadmin/cli/keytab.c | 12 |
3 files changed, 36 insertions, 6 deletions
diff --git a/src/kadmin/cli/ChangeLog b/src/kadmin/cli/ChangeLog index 33f8b50..946ee6a 100644 --- a/src/kadmin/cli/ChangeLog +++ b/src/kadmin/cli/ChangeLog @@ -1,3 +1,12 @@ +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. diff --git a/src/kadmin/cli/kadmin.c b/src/kadmin/cli/kadmin.c index 67c7b46..1881c87 100644 --- a/src/kadmin/cli/kadmin.c +++ b/src/kadmin/cli/kadmin.c @@ -421,9 +421,24 @@ char *kadmin_startup(argc, argv) 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; diff --git a/src/kadmin/cli/keytab.c b/src/kadmin/cli/keytab.c index 3382063..5a47bf1 100644 --- a/src/kadmin/cli/keytab.c +++ b/src/kadmin/cli/keytab.c @@ -23,7 +23,6 @@ static int remove_principal(char *keytab_str, krb5_keytab keytab, char *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; @@ -45,8 +44,15 @@ int process_keytab(krb5_context context, char **keytab_str, 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); |