Replace adm_find_keytype() with krb5_dbe_find_keytype()
authorPaul Park <pjpark@mit.edu>
Tue, 15 Aug 1995 18:30:42 +0000 (18:30 +0000)
committerPaul Park <pjpark@mit.edu>
Tue, 15 Aug 1995 18:30:42 +0000 (18:30 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6525 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin.old/server/ChangeLog
src/kadmin.old/server/adm_adm_func.c
src/kadmin.old/server/adm_extern.h
src/kadmin.old/server/adm_fmt_inq.c
src/kadmin.old/server/adm_funcs.c
src/kadmin.old/server/adm_process.c
src/kadmin.old/server/adm_server.c

index cd9333c880a9790e06cdd144722cb88261d10f91..d47eabc2beaf6b256fbd31c4c75f3975027a0dc3 100644 (file)
@@ -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
index 6fbd8e58b41823da369b17971fa4f30ab9404c9d..2f09cde7a31524d87aad69f741aac53a38c55827 100644 (file)
@@ -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);
        }
        
index 8e621eaae0e94119e51f5ed1c55ed329d619eed8..b25c20bb43f37d2bc4698a5cc06c0be3c404eb62 100644 (file)
@@ -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 *,
index f111c2341ada6b2b8085e6693aa196f28460b998..94a1fc52a4e566f3524465a31b3ce6b7d6ec55a0 100644 (file)
@@ -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;
     }
index c57674c4d712e03e5375c704797dead0a577f7cc..2e612c9063f933e4d92c7d67e290a6a4215d5103 100644 (file)
@@ -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; i<dbentp->n_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;
index 39fc77d71e76f2d9cc46c6b258555b7a9140f45c..98ab5ac1ffc84f135e30b4d00a98846143b36d5a 100644 (file)
@@ -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");
index fcb95b08a6de5622d1a52b73469295836d9e3689..7969ceb70e3adeaefc6c8493036110dc58e2a389 100644 (file)
@@ -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));