From bdbe1827543a9062e78f477328c64031698576ae Mon Sep 17 00:00:00 2001 From: Paul Park Date: Tue, 15 Aug 1995 18:32:28 +0000 Subject: [PATCH] Replace kadm_find_keytype() with krb5_dbe_find_keytype() git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6526 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin.v4/server/ChangeLog | 5 ++ src/kadmin.v4/server/admin_server.c | 7 ++- src/kadmin.v4/server/kadm_funcs.c | 83 ++++++++++++---------------- src/kadmin.v4/server/kadm_ser_wrap.c | 10 ++-- 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/kadmin.v4/server/ChangeLog b/src/kadmin.v4/server/ChangeLog index 06d581542..fd1eec3eb 100644 --- a/src/kadmin.v4/server/ChangeLog +++ b/src/kadmin.v4/server/ChangeLog @@ -1,4 +1,9 @@ +Tue Aug 15 14:31:37 EDT 1995 Paul Park (pjpark@mit.edu) + * admin_server,kadm_funcs,kadm_ser_wrap.c - Replace kadm_find_keytype() + with krb5_dbe_find_keytype(). + + Thu Aug 10 14:48:26 EDT 1995 Paul Park (pjpark@mit.edu) * kadm_funcs.c - Add kadm_find_keytype() to find a particular key/salt pair. Use this to find keys instead of assuming that the diff --git a/src/kadmin.v4/server/admin_server.c b/src/kadmin.v4/server/admin_server.c index c9bd3e1e8..bc5554b4e 100644 --- a/src/kadmin.v4/server/admin_server.c +++ b/src/kadmin.v4/server/admin_server.c @@ -380,7 +380,12 @@ struct sockaddr_in *who; cleanexit(2); } - status = kadm_find_keytype(&sprinc_entries, KEYTYPE_DES, -1, &kdatap); + status = krb5_dbe_find_keytype(kadm_context, + &sprinc_entries, + KEYTYPE_DES, + -1, + -1, + &kdatap); if (status) { syslog(LOG_ERR, "find keytype failed: %s", error_message(status)); cleanexit(1); diff --git a/src/kadmin.v4/server/kadm_funcs.c b/src/kadmin.v4/server/kadm_funcs.c index 2284b726e..01cb55b13 100644 --- a/src/kadmin.v4/server/kadm_funcs.c +++ b/src/kadmin.v4/server/kadm_funcs.c @@ -78,7 +78,12 @@ kadm_entry2princ(entry, princ) krb5_xfree(mprinc); /* Find the V4 key */ - retval = kadm_find_keytype(&entry, KEYTYPE_DES, KRB5_KDB_SALTTYPE_V4, &pkey); + retval = krb5_dbe_find_keytype(kadm_context, + &entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &pkey); if (retval) return retval; princ->key_version = pkey->key_data_kvno; @@ -122,10 +127,12 @@ kadm_princ2entry(princ, entry) if (mprinc.mod_princ) krb5_free_principal(kadm_context, mprinc.mod_princ); - if (retval = kadm_find_keytype(entry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_V4, - &kdatap)) { + if (retval = krb5_dbe_find_keytype(kadm_context, + entry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &kdatap)) { if (!(retval = krb5_dbe_create_key_data(kadm_context, entry))) kdatap = &entry->key_data[entry->n_key_data-1]; } @@ -236,10 +243,12 @@ Kadm_vals *valsout; if ((newpw.contents = (krb5_octet *)malloc(8)) == NULL) failadd(KADM_NOMEM); - if (retval = kadm_find_keytype(&newentry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_V4, - &pkey)) { + if (retval = krb5_dbe_find_keytype(kadm_context, + &newentry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &pkey)) { if (!(retval = krb5_dbe_create_key_data(kadm_context, &newentry))) pkey = &newentry.key_data[newentry.n_key_data-1]; } @@ -543,10 +552,12 @@ Kadm_vals *valsout; /* the actual record which is returned */ temp_key.key_high = ntohl(temp_key.key_high); memcpy(newpw.contents, &temp_key.key_low, 4); memcpy(newpw.contents + 4, &temp_key.key_high, 4); - if (retval = kadm_find_keytype(&newentry, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_V4, - &pkey)) { + if (retval = krb5_dbe_find_keytype(kadm_context, + &newentry, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &pkey)) { krb5_db_free_principal(kadm_context, &newentry, 1); memset((char *)&temp_key, 0, sizeof (temp_key)); failmod(retval); @@ -678,10 +689,12 @@ des_cblock newpw; free(localpw.contents); failchange(retval); } else if (numfound == 1) { - if (retval = kadm_find_keytype(&odata, - KEYTYPE_DES, - KRB5_KDB_SALTTYPE_V4, - &pkey)) { + if (retval = krb5_dbe_find_keytype(kadm_context, + &odata, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &pkey)) { failchange(retval); } pkey->key_data_kvno++; @@ -958,8 +971,12 @@ kadm_chg_srvtab(rname, rinstance, rrealm, values) krb5_free_principal(kadm_context, inprinc); failsrvtab(retval); } else if (numfound) { - retval = kadm_find_keytype(&odata, KEYTYPE_DES, KRB5_KDB_SALTTYPE_V4, - &pkey); + retval = krb5_dbe_find_keytype(kadm_context, + &odata, + KEYTYPE_DES, + KRB5_KDB_SALTTYPE_V4, + -1, + &pkey); if (retval) { krb5_free_principal(kadm_context, inprinc); failsrvtab(retval); @@ -1054,31 +1071,3 @@ kadm_chg_srvtab(rname, rinstance, rrealm, values) } #undef failsrvtab - -krb5_error_code -kadm_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); -} diff --git a/src/kadmin.v4/server/kadm_ser_wrap.c b/src/kadmin.v4/server/kadm_ser_wrap.c index c7e181322..17d000ed0 100644 --- a/src/kadmin.v4/server/kadm_ser_wrap.c +++ b/src/kadmin.v4/server/kadm_ser_wrap.c @@ -108,10 +108,12 @@ kadm_ser_init(inter, realm) if (retval || more || !numfound) return KADM_NO_VERI; - retval = kadm_find_keytype(&master_entry, - KEYTYPE_DES, - -1, - &kdatap); + retval = krb5_dbe_find_keytype(kadm_context, + &master_entry, + KEYTYPE_DES, + -1, + -1, + &kdatap); if (retval) return KRB5_PROG_KEYTYPE_NOSUPP; server_parm.max_life = master_entry.max_life; -- 2.26.2