From 520738769186bf34c46b48adcdd624c5bf9fcb3c Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 13 Jan 1994 23:45:34 +0000 Subject: [PATCH] Don't clear the key and alt_key structures prematurely when adding a principal git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3323 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/server/adm_funcs.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/kadmin/server/adm_funcs.c b/src/kadmin/server/adm_funcs.c index 99e1aecdc..9c1c5fce4 100644 --- a/src/kadmin/server/adm_funcs.c +++ b/src/kadmin/server/adm_funcs.c @@ -170,6 +170,23 @@ OLDDECLARG(krb5_db_entry *, entry) krb5_timestamp KDB5_EXP_DATE = KRB5_KDB_EXPIRATION; extern krb5_flags NEW_ATTRIBUTES; + if (!req_type) { /* New entry - initialize */ + memset((char *) entry, 0, sizeof(*entry)); + entry->principal = (krb5_principal) principal; + entry->kvno = KDB5_VERSION_NUM; + entry->max_life = KDB5_MAX_TKT_LIFE; + entry->max_renewable_life = KDB5_MAX_REN_LIFE; + entry->mkvno = mblock.mkvno; + entry->expiration = KDB5_EXP_DATE; + entry->mod_name = master_princ; + } else { /* Modify existing entry */ + entry->kvno++; +#ifdef SANDIA + entry->attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE; +#endif + entry->mod_name = (krb5_principal) principal; + } + if (key && key->length) { retval = krb5_kdb_encrypt_key(&master_encblock, key, @@ -192,23 +209,6 @@ OLDDECLARG(krb5_db_entry *, entry) } } - if (!req_type) { /* New entry - initialize */ - memset((char *) entry, 0, sizeof(*entry)); - entry->principal = (krb5_principal) principal; - entry->kvno = KDB5_VERSION_NUM; - entry->max_life = KDB5_MAX_TKT_LIFE; - entry->max_renewable_life = KDB5_MAX_REN_LIFE; - entry->mkvno = mblock.mkvno; - entry->expiration = KDB5_EXP_DATE; - entry->mod_name = master_princ; - } else { /* Modify existing entry */ - entry->kvno++; -#ifdef SANDIA - entry->attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE; -#endif - entry->mod_name = (krb5_principal) principal; - } - if (retval = krb5_timeofday(&entry->mod_date)) { com_err("adm_modify_kdb", retval, "while fetching date"); memset((char *) entry->key.contents, 0, entry->key.length); -- 2.26.2