* kdb5_edit.c (enter_master_key, set_dbname_help): If master key
authorEzra Peisach <epeisach@mit.edu>
Wed, 14 Feb 1996 14:55:34 +0000 (14:55 +0000)
committerEzra Peisach <epeisach@mit.edu>
Wed, 14 Feb 1996 14:55:34 +0000 (14:55 +0000)
                enctype is unknown, set to DEFAULT_KDC_ENCTYPE.

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

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

index 1d739401ca8f2c4d349fbd5db3617dea616b5bfb..bd2682297f3f2510c995fd7a4c9bba8bc725ad51 100644 (file)
@@ -1,3 +1,8 @@
+Wed Feb 14 09:52:18 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * kdb5_edit.c (enter_master_key, set_dbname_help): If master key
+               enctype is unknown, set to DEFAULT_KDC_ENCTYPE.
+
 Tue Feb 13 16:08:07 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
 
        * kdb5_edit.c (extract_v4_srvtab): krb5_dbekd_decrypt_key_data
index fd8740b5b409689b991c01f94ed8d810cef9f1dc..ea3d0c852dbcaa3b5952898dd41532d37caefa30 100644 (file)
@@ -255,17 +255,17 @@ char *kdb5_edit_Init(argc, argv)
     }
 
     if (master_keyblock.enctype != ENCTYPE_UNKNOWN) {
-       if (!valid_enctype(master_keyblock.enctype)) {
-           char tmp[32];
-           if (krb5_enctype_to_string(master_keyblock.enctype,
-                                      tmp, sizeof(tmp)))
-               com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP,
-                       "while setting up enctype %d", master_keyblock.enctype);
-           else
-               com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, tmp);
-           exit(1);
-       }
-       krb5_use_enctype(edit_context, &master_encblock,
+           if (!valid_enctype(master_keyblock.enctype)) {
+                   char tmp[32];
+                   if (krb5_enctype_to_string(master_keyblock.enctype,
+                                              tmp, sizeof(tmp)))
+                           com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP,
+                                   "while setting up enctype %d", master_keyblock.enctype);
+                   else
+                           com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, tmp);
+                   exit(1);
+           }
+           krb5_use_enctype(edit_context, &master_encblock,
                         master_keyblock.enctype);
     }
 
@@ -479,6 +479,24 @@ set_dbname_help(pname, dbname)
            com_err(pname, retval, "while calculated master key salt");
            return(1);
        }
+
+       /* If no encryption type is set, use the default */
+       if (master_keyblock.enctype == ENCTYPE_UNKNOWN) {
+               master_keyblock.enctype = DEFAULT_KDC_ENCTYPE;
+               if (!valid_enctype(master_keyblock.enctype)) {
+                       char tmp[32];
+                       if (krb5_enctype_to_string(master_keyblock.enctype,
+                                                  tmp, sizeof(tmp)))
+                               com_err(pname, KRB5_PROG_KEYTYPE_NOSUPP,
+                                       "while setting up enctype %d", master_keyblock.enctype);
+                       else
+                               com_err(pname, KRB5_PROG_KEYTYPE_NOSUPP, tmp);
+                       exit(1);
+               }
+               krb5_use_enctype(edit_context, &master_encblock,
+                                master_keyblock.enctype);
+       }
+
        retval = krb5_string_to_key(edit_context, &master_encblock, 
                                    &master_keyblock, &pwd, &scratch);
        if (retval) {
@@ -557,7 +575,25 @@ void enter_master_key(argc, argv)
                       master_keyblock.length);
                krb5_xfree(master_keyblock.contents);
                master_keyblock.contents = NULL;
+               valid_master_key = 0;
        }
+
+       if (master_keyblock.enctype == ENCTYPE_UNKNOWN) {
+               master_keyblock.enctype = DEFAULT_KDC_ENCTYPE;
+               if (!valid_enctype(master_keyblock.enctype)) {
+                       char tmp[32];
+                       if (krb5_enctype_to_string(master_keyblock.enctype,
+                                                  tmp, sizeof(tmp)))
+                               com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP,
+                                       "while setting up enctype %d", master_keyblock.enctype);
+                       else
+                               com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, tmp);
+                       exit(1);
+               }
+               krb5_use_enctype(edit_context, &master_encblock,
+                                master_keyblock.enctype);
+       }
+
        if ((retval = krb5_db_fetch_mkey(edit_context, master_princ,
                                         &master_encblock,
                                        TRUE, FALSE, (char *) NULL,