From bffdc17447283da71bf2f16bd549c9b0236414b1 Mon Sep 17 00:00:00 2001 From: Paul Park Date: Tue, 15 Aug 1995 18:30:42 +0000 Subject: [PATCH] Replace adm_find_keytype() with krb5_dbe_find_keytype() git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6525 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin.old/server/ChangeLog | 5 +++ src/kadmin.old/server/adm_adm_func.c | 54 +++++++++++++++++----------- src/kadmin.old/server/adm_extern.h | 6 ---- src/kadmin.old/server/adm_fmt_inq.c | 10 +++--- src/kadmin.old/server/adm_funcs.c | 28 --------------- src/kadmin.old/server/adm_process.c | 20 ++++++----- src/kadmin.old/server/adm_server.c | 10 +++--- 7 files changed, 62 insertions(+), 71 deletions(-) diff --git a/src/kadmin.old/server/ChangeLog b/src/kadmin.old/server/ChangeLog index cd9333c88..d47eabc2b 100644 --- a/src/kadmin.old/server/ChangeLog +++ b/src/kadmin.old/server/ChangeLog @@ -1,4 +1,9 @@ +Tue Aug 15 14:29:26 EDT 1995 Paul Park (pjpark@mit.edu) + * adm_{adm_func,fmt_inq,funcs,process,server}.c, adm_extern.h - Replace + adm_find_keytype() with krb5_dbe_find_keytype(). + + Thu Aug 10 14:38:14 EDT 1995 Paul Park (pjpark@mit.edu) * adm_funcs.c - Rework adm_modify_kdb() to use kdb5's change-password interfaces. Gut callers of adm_modify_kdb() because most of diff --git a/src/kadmin.old/server/adm_adm_func.c b/src/kadmin.old/server/adm_adm_func.c index 6fbd8e58b..2f09cde7a 100644 --- a/src/kadmin.old/server/adm_adm_func.c +++ b/src/kadmin.old/server/adm_adm_func.c @@ -109,12 +109,16 @@ adm_build_key (context, auth_context, new_passwd, oper_type, entry) if (oper_type == CHGOPER || oper_type == CH4OPER) { key_data = (krb5_key_data *) NULL; - if (adm_find_keytype(&entry, - KEYTYPE_DES, - ((oper_type == CHGOPER) ? - KRB5_KDB_SALTTYPE_NORMAL : KRB5_KDB_SALTTYPE_V4), - &key_data)) { + if (krb5_dbe_find_keytype(context, + &entry, + KEYTYPE_DES, + ((oper_type == CHGOPER) ? + KRB5_KDB_SALTTYPE_NORMAL : + KRB5_KDB_SALTTYPE_V4), + -1, + &key_data)) { com_err("adm_build_key", ENOENT, "finding key data"); + return(4); /* Unable to get password */ } outbuf.data[3] = key_data->key_data_type[1]; outbuf.length = 4; @@ -597,25 +601,33 @@ adm_mod_old_key(context, auth_context, cmdname, customer_name) * We could loop through all the supported key/salt types, but * we don't have that technology yet. */ - if (!adm_find_keytype(&entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_NORMAL, - &kdata)) + if (!krb5_dbe_find_keytype(context, + &entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_NORMAL, + -1, + &kdata)) kdata->key_data_kvno = atoi(tempstr); - if (!adm_find_keytype(&entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_V4, - &kdata)) + if (!krb5_dbe_find_keytype(context, + &entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &kdata)) kdata->key_data_kvno = atoi(tempstr); - if (!adm_find_keytype(&entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_NOREALM, - &kdata)) + if (!krb5_dbe_find_keytype(context, + &entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_NOREALM, + -1, + &kdata)) kdata->key_data_kvno = atoi(tempstr); - if (!adm_find_keytype(&entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_ONLYREALM, - &kdata)) + if (!krb5_dbe_find_keytype(context, + &entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_ONLYREALM, + -1, + &kdata)) kdata->key_data_kvno = atoi(tempstr); } diff --git a/src/kadmin.old/server/adm_extern.h b/src/kadmin.old/server/adm_extern.h index 8e621eaae..b25c20bb4 100644 --- a/src/kadmin.old/server/adm_extern.h +++ b/src/kadmin.old/server/adm_extern.h @@ -158,12 +158,6 @@ krb5_error_code adm_enter_rnd_pwd_key int, krb5_db_entry *)); -krb5_error_code adm_find_keytype - PROTOTYPE((krb5_db_entry *, - krb5_keytype, - krb5_int32, - krb5_key_data **)); - krb5_error_code adm_update_tl_attrs PROTOTYPE((krb5_context, krb5_db_entry *, diff --git a/src/kadmin.old/server/adm_fmt_inq.c b/src/kadmin.old/server/adm_fmt_inq.c index f111c2341..94a1fc52a 100644 --- a/src/kadmin.old/server/adm_fmt_inq.c +++ b/src/kadmin.old/server/adm_fmt_inq.c @@ -169,10 +169,12 @@ adm_fmt_prt(context, entry, Principal_name, ret_data) entry->max_renewable_life); strcat(my_data, thisline); pkey = (krb5_key_data *) NULL; - if (retval = adm_find_keytype(entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_NORMAL, - &pkey)) { + if (retval = krb5_dbe_find_keytype(context, + entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_NORMAL, + -1, + &pkey)) { free(my_data); return retval; } diff --git a/src/kadmin.old/server/adm_funcs.c b/src/kadmin.old/server/adm_funcs.c index c57674c4d..2e612c906 100644 --- a/src/kadmin.old/server/adm_funcs.c +++ b/src/kadmin.old/server/adm_funcs.c @@ -345,34 +345,6 @@ adm_enter_rnd_pwd_key(context, cmdname, change_princ, req_type, entry) return(retval); } -krb5_error_code -adm_find_keytype(dbentp, keytype, salttype, kentp) - krb5_db_entry *dbentp; - krb5_keytype keytype; - krb5_int32 salttype; - krb5_key_data **kentp; -{ - int i; - int maxkvno; - krb5_key_data *datap; - - maxkvno = -1; - datap = (krb5_key_data *) NULL; - for (i=0; in_key_data; i++) { - if ((dbentp->key_data[i].key_data_type[0] == keytype) && - ((dbentp->key_data[i].key_data_type[1] == salttype) || - (salttype < 0))) { - maxkvno = dbentp->key_data[i].key_data_kvno; - datap = &dbentp->key_data[i]; - } - } - if (maxkvno >= 0) { - *kentp = datap; - return(0); - } - return(ENOENT); -} - krb5_error_code adm_update_tl_attrs(kcontext, dbentp, mod_name, is_pwchg) krb5_context kcontext; diff --git a/src/kadmin.old/server/adm_process.c b/src/kadmin.old/server/adm_process.c index 39fc77d71..98ab5ac1f 100644 --- a/src/kadmin.old/server/adm_process.c +++ b/src/kadmin.old/server/adm_process.c @@ -80,10 +80,12 @@ cpw_keyproc(context, keyblock) } /* Find our key */ - if (retval = adm_find_keytype(&cpw_entry, - KEYTYPE_DES, - -1, - &kdatap)) { + if (retval = krb5_dbe_find_keytype(context, + &cpw_entry, + KEYTYPE_DES, + -1, + -1, + &kdatap)) { krb5_db_free_principal(context, &cpw_entry, nprincs); syslog(LOG_ERR, "cpw_keyproc: cannot find server DES key"); close(client_server_info.client_socket); @@ -206,10 +208,12 @@ process_client(context, prog) } /* Find our key */ - if (retval = adm_find_keytype(&server_entry, - KEYTYPE_DES, - -1, - &kdatap)) { + if (retval = krb5_dbe_find_keytype(context, + &server_entry, + KEYTYPE_DES, + -1, + -1, + &kdatap)) { krb5_db_free_principal(context, &server_entry, number_of_entries); syslog(LOG_ERR, "kadmind error: cannot find server DES key"); diff --git a/src/kadmin.old/server/adm_server.c b/src/kadmin.old/server/adm_server.c index fcb95b08a..7969ceb70 100644 --- a/src/kadmin.old/server/adm_server.c +++ b/src/kadmin.old/server/adm_server.c @@ -359,10 +359,12 @@ init_db(context, dbname, masterkeyname, masterkeyblock) convert server.key into a real key (it may be encrypted in the database) */ - if (retval = adm_find_keytype(&server_entry, - KEYTYPE_DES, - -1, - &kdatap)) { + if (retval = krb5_dbe_find_keytype(context, + &server_entry, + KEYTYPE_DES, + -1, + -1, + &kdatap)) { krb5_db_free_principal(context, &server_entry, number_of_entries); (void) krb5_finish_key(context, &master_encblock); memset((char *)&master_encblock, 0, sizeof(master_encblock)); -- 2.26.2