* server_kdb.c (kdb_init_hist): Force history principal's key to
authorTom Yu <tlyu@mit.edu>
Fri, 13 Jun 2003 22:30:59 +0000 (22:30 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 13 Jun 2003 22:30:59 +0000 (22:30 +0000)
be of the same enctype as the master key, as searches for it later
on explicitly specify the enctype.

ticket: 964
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15621 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/srv/ChangeLog
src/lib/kadm5/srv/server_kdb.c

index 334d063cdf993093096ed7ea072ad5e854af4bfa..5c53f6011c4036a4311a945275c9c1e42757dc34 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-13  Tom Yu  <tlyu@mit.edu>
+
+       * server_kdb.c (kdb_init_hist): Force history principal's key to
+       be of the same enctype as the master key, as searches for it later
+       on explicitly specify the enctype.
+
 2003-04-01  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in: Remove $(SHLIB_DBLIB_DEPS) and related variables.
index 231fcb3ef976e48cbf472b4fede99900f55761c3..97d38c7b6b5dae810e859b9ebd0e8b4cde9df554 100644 (file)
@@ -107,6 +107,7 @@ krb5_error_code kdb_init_hist(kadm5_server_handle_t handle, char *r)
     int            ret = 0;
     char    *realm, *hist_name;
     krb5_key_data *key_data;
+    krb5_key_salt_tuple ks[1];
 
     if (r == NULL)  {
        if ((ret = krb5_get_default_realm(handle->context, &realm)))
@@ -144,11 +145,13 @@ krb5_error_code kdb_init_hist(kadm5_server_handle_t handle, char *r)
           history principal, anyway. */
 
        hist_kvno = 2;
-
-       ret = kadm5_create_principal(handle, &ent,
-                                    (KADM5_PRINCIPAL | KADM5_MAX_LIFE |
-                                     KADM5_ATTRIBUTES),
-                                    "to-be-random");
+       ks[0].ks_enctype = handle->params.enctype;
+       ks[0].ks_salttype = KRB5_KDB_SALTTYPE_NORMAL;
+       ret = kadm5_create_principal_3(handle, &ent,
+                                      (KADM5_PRINCIPAL | KADM5_MAX_LIFE |
+                                       KADM5_ATTRIBUTES),
+                                      1, ks,
+                                      "to-be-random");
        if (ret)
            goto done;
 
@@ -156,7 +159,8 @@ krb5_error_code kdb_init_hist(kadm5_server_handle_t handle, char *r)
 
        hist_princ = NULL;
 
-       ret = kadm5_randkey_principal(handle, ent.principal, NULL, NULL);
+       ret = kadm5_randkey_principal_3(handle, ent.principal, 0, 1, ks,
+                                       NULL, NULL);
 
        hist_princ = ent.principal;