Set the enctype to ENCTYPE_UNKNOWN when the enctype should be determined from
authorRichard Basch <probe@mit.edu>
Thu, 11 Jan 1996 12:05:07 +0000 (12:05 +0000)
committerRichard Basch <probe@mit.edu>
Thu, 11 Jan 1996 12:05:07 +0000 (12:05 +0000)
the stash file.

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

src/admin/edit/kdb5_edit.c
src/kadmin/v5server/srv_key.c
src/kdc/main.c

index 838d44f208a45da44529e9db5d03aa03b02deee5..b6e92d7a5cbf47942b78bbd0bdd9bed316686aef 100644 (file)
@@ -251,10 +251,10 @@ char *kdb5_edit_Init(argc, argv)
        if (manual_mkey)
            master_keyblock.enctype = DEFAULT_KDC_ENCTYPE;
        else
-           master_keyblock.enctype = NULL;
+           master_keyblock.enctype = ENCTYPE_UNKNOWN;
     }
 
-    if (master_keyblock.enctype) {
+    if (master_keyblock.enctype != ENCTYPE_UNKNOWN) {
        if (!valid_enctype(master_keyblock.enctype)) {
            char tmp[32];
            if (krb5_enctype_to_string(master_keyblock.enctype,
index 25e709833f8793962692e5323574781ac0a3fd02..e0910e61c211b3cf33e4e5e1268601ab77f21b69 100644 (file)
@@ -367,7 +367,12 @@ key_init(kcontext, debug_level, key_type, master_key_name, manual,
     /*
      * Figure out arguments.
      */
-    master_keyblock.enctype=((key_type == -1) ? DEFAULT_KDC_ENCTYPE : key_type);
+    if (key_type == -1)
+       master_keyblock.enctype =
+           manual ? DEFAULT_KDC_ENCTYPE : ENCTYPE_UNKNOWN;
+    else
+       master_keyblock.enctype = key_type;
+
     mkey_name = ((!master_key_name) ? KRB5_KDB_M_NAME : master_key_name);
 
     /*
@@ -466,7 +471,9 @@ key_init(kcontext, debug_level, key_type, master_key_name, manual,
     }
     ment_init = 1;
 
-    krb5_use_enctype(kcontext, &master_encblock, master_keyblock.enctype);
+    /* krb5_db_fetch_mkey will setup the eblock if it is reading the stash */
+    if (manual)
+       krb5_use_enctype(kcontext, &master_encblock, master_keyblock.enctype);
 
     /* Go get the master key */
     kret = krb5_db_fetch_mkey(kcontext,
@@ -739,7 +746,6 @@ key_string2key_keysalt(ksent, ptr)
         */
        if ((kret = krb5_string_to_key(argp->context,
                                       &master_encblock,
-                                      kdata->key_data_type[0],
                                       &key,
                                       argp->string,
                                       &salt)))
index 27c38c66f596930cfc3ec2f050b1f59bfd94c03c..c2671388a88027418621ce628e5f8940036d7ad0 100644 (file)
@@ -697,7 +697,7 @@ initialize_realms(kcontext, argc, argv)
     char               *rcname = KDCRCACHE;
     char               *lrealm;
     krb5_error_code    retval;
-    krb5_enctype       menctype = ENCTYPE_DES_CBC_CRC;
+    krb5_enctype       menctype = ENCTYPE_UNKNOWN;
     kdc_realm_t                *rdatap;
     krb5_boolean       manual = FALSE;
     char               *default_ports = 0;
@@ -742,6 +742,8 @@ initialize_realms(kcontext, argc, argv)
            break;
        case 'm':                       /* manual type-in of master key */
            manual = TRUE;
+           if (menctype == ENCTYPE_UNKNOWN)
+               menctype = ENCTYPE_DES_CBC_CRC;
            break;
        case 'M':                       /* master key name in DB */
            mkey_name = optarg;