Use the kdc.conf file to determine the default list of keysalt tuples
authorTheodore Tso <tytso@mit.edu>
Wed, 4 Oct 1995 03:12:32 +0000 (03:12 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 4 Oct 1995 03:12:32 +0000 (03:12 +0000)
to be used.  This is stored in std_ks_tuple, and is used by cpw.c for
random keys and when a list of keysalts is not specified.

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

src/admin/edit/ChangeLog
src/admin/edit/cpw.c
src/admin/edit/kdb5_edit.c
src/admin/edit/kdb5_edit.h

index e368ad904ff2f91d6ac1a2a9e9102c7c2ab48718..4409397cd4bfaedc5a651556e36feb459b6e428a 100644 (file)
@@ -1,3 +1,11 @@
+Tue Oct  3 23:10:57 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * cpw.c (enter_rnd_key, enter_pwd_key):
+       * kdb5_edit.c (kdb5_edit_Init): Use the kdc.conf file to determine
+               the default list of keysalt tuples to be used.  This is
+               stored in std_ks_tuple, and is used by cpw.c for random
+               keys and when a list of keysalts is not specified.
+
 Mon Sep 18 03:59:47 1995  Ezra Peisach  <epeisach@kangaroo.mit.edu>
 
        * kdb5_edit.c (show_principal): Show key version and last password
index 9a362e6ecc0ea8660d7266f31e0ea51546cdf388..adb8e9c6b5ea680d155754c9d79b7463368616b0 100644 (file)
@@ -51,16 +51,6 @@ extern char *krb5_default_pwd_prompt1, *krb5_default_pwd_prompt2;
 extern krb5_boolean dbactive;
 extern FILE *scriptfile;
 
-/*
- * XXX  This realy should be configured from kdc.conf
- */
-static krb5_key_salt_tuple ks_tuple_rnd_def[] =
-       {{ ENCTYPE_DES_CBC_CRC, 0 },
-        { ENCTYPE_DES_CBC_MD5, 0 },
-        { ENCTYPE_DES_CBC_CRC, KRB5_KDB_SALTTYPE_V4},
-        { ENCTYPE_DES_CBC_MD5, KRB5_KDB_SALTTYPE_V4}};
-static int ks_tuple_rnd_def_count = 4;
-
 static void
 enter_rnd_key(argc, argv, entry)
     int                          argc;
@@ -71,8 +61,8 @@ enter_rnd_key(argc, argv, entry)
     int                  nprincs = 1;
     
     if ((retval = krb5_dbe_crk(edit_context, &master_encblock,
-                              ks_tuple_rnd_def,
-                              ks_tuple_rnd_def_count, entry))) {
+                              std_ks_tuple,
+                              std_ks_tuple_count, entry))) {
        com_err(argv[0], retval, "while generating random key");
         krb5_db_free_principal(edit_context, entry, nprincs);
        exit_status++;
@@ -187,9 +177,6 @@ void change_rnd_key(argc, argv)
     }
 }
 
-static krb5_key_salt_tuple ks_tuple_default[] = {{ ENCTYPE_DES_CBC_CRC, 0 }};
-static int ks_tuple_count_default = 1;
-
 void 
 enter_pwd_key(cmdname, princ, ks_tuple, ks_tuple_count, entry)
     char               * cmdname;
@@ -229,8 +216,8 @@ enter_pwd_key(cmdname, princ, ks_tuple, ks_tuple_count, entry)
     }
     
     if (ks_tuple_count == 0) {
-       ks_tuple_count = ks_tuple_count_default;
-       ks_tuple = ks_tuple_default;
+       ks_tuple_count = std_ks_tuple_count;
+       ks_tuple = std_ks_tuple;
     }
     if ((retval = krb5_dbe_cpw(edit_context, &master_encblock, ks_tuple,
                               ks_tuple_count, password, entry))) {
index c56015beb9ca4d9666f85e1fbdb0d3982b5ef091..d531ba2354d06d42f54cd6272aa1214a43412c2e 100644 (file)
@@ -40,11 +40,15 @@ struct mblock mblock = {                            /* XXX */
     0
 };
 
+krb5_key_salt_tuple ks_tuple_default[] = {{ ENCTYPE_DES_CBC_CRC, 0 }};
+
+krb5_key_salt_tuple *std_ks_tuple = ks_tuple_default;
+int std_ks_tuple_count = 1;
+
 char   *Err_no_master_msg = "Master key not entered!\n";
 char   *Err_no_database = "Database not currently opened!\n";
 char   *current_dbname = NULL;
 
-
 /*
  * XXX Ick, ick, ick.  These global variables shouldn't be global....
  */
@@ -216,6 +220,15 @@ char *kdb5_edit_Init(argc, argv)
        if (rparams->realm_flags_valid)
            mblock.flags = rparams->realm_flags;
 
+       /* Get the value of the supported key/salt pairs */
+       if (rparams->realm_num_keysalts) {
+           std_ks_tuple_count = rparams->realm_num_keysalts;
+           std_ks_tuple = rparams->realm_keysalts;
+           rparams->realm_num_keysalts = 0;
+           rparams->realm_keysalts = (krb5_key_salt_tuple *) NULL;
+       }
+
+
        krb5_free_realm_params(edit_context, rparams);
     }
 
index cc988011d266e1d17476ffbe9985b6fcd791f3ea..c04f2ed96d9425cfc565881e6839fe1d4c041cae 100644 (file)
@@ -36,6 +36,9 @@ struct mblock {
     krb5_kvno mkvno;
 };
 
+extern krb5_key_salt_tuple *std_ks_tuple;
+extern int std_ks_tuple_count;
+
 void add_key 
        PROTOTYPE((char const *, char const *, 
                   krb5_const_principal, const krb5_keyblock *,