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

src/kadmin.v4/server/ChangeLog
src/kadmin.v4/server/admin_server.c
src/kadmin.v4/server/kadm_funcs.c
src/kadmin.v4/server/kadm_ser_wrap.c

index 06d581542fa70420ef633019491282e85f543095..fd1eec3ebd1cd99c67a401c79e734f411a232ed2 100644 (file)
@@ -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
index c9bd3e1e85557d1f2713bf72d29b95e1d53e18fa..bc5554b4e74842a46afa6e7b72ab8740ed6ddaf1 100644 (file)
@@ -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);
index 2284b726ecb7dc6d32f1ab2a8cc0ffade51fa66c..01cb55b135070b492ebec79333e25c819432826d 100644 (file)
@@ -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; 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);    
-}
index c7e18132230566a4ffcb49a3351141aa3b0d14f6..17d000ed046944d5175397895ed8dabd86e8e41f 100644 (file)
@@ -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;