* main.c: Use the master key enctype from the stash file if none
authorRichard Basch <probe@mit.edu>
Tue, 12 Dec 1995 02:34:56 +0000 (02:34 +0000)
committerRichard Basch <probe@mit.edu>
Tue, 12 Dec 1995 02:34:56 +0000 (02:34 +0000)
is specified (set the keyblock enctype to NULL).

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

src/kdc/main.c

index 260c40257c26b9863c5ce2e734be447d4e24b6d8..49f2a89ed37a276ad59c37029b3d1cb7d07e0add 100644 (file)
@@ -337,14 +337,6 @@ init_realm(progname, rdp, realm, def_dbname, def_mpname,
                rdp->realm_mpname = (def_mpname) ? strdup(def_mpname) :
                    strdup(KRB5_KDB_M_NAME);
 
-           /* Handle master key type */
-           if (rparams && rparams->realm_enctype_valid)
-               rdp->realm_mkey.enctype =
-                   (krb5_enctype) rparams->realm_enctype;
-           else
-               rdp->realm_mkey.enctype = (def_enctype) ? def_enctype :
-                   ENCTYPE_DES_CBC_CRC;
-
            /* Handle KDC port */
            if (rparams && rparams->realm_kdc_ports)
                rdp->realm_ports = strdup(rparams->realm_kdc_ports);
@@ -359,6 +351,15 @@ init_realm(progname, rdp, realm, def_dbname, def_mpname,
            else
                manual = def_manual;
 
+           /* Handle master key type */
+           if (rparams && rparams->realm_enctype_valid)
+               rdp->realm_mkey.enctype =
+                   (krb5_enctype) rparams->realm_enctype;
+           else
+               /* If not manual, we can lookup the enctype */
+               rdp->realm_mkey.enctype = (def_enctype || !manual)
+                   ? def_enctype : ENCTYPE_DES_CBC_CRC;
+
            /* Handle ticket maximum life */
            rdp->realm_maxlife = (rparams && rparams->realm_max_life_valid) ?
                rparams->realm_max_life : KRB5_KDB_MAX_LIFE;
@@ -423,8 +424,9 @@ init_realm(progname, rdp, realm, def_dbname, def_mpname,
            }
 
            /* Select the specified encryption type */
-           krb5_use_enctype(rdp->realm_context, &rdp->realm_encblock, 
-                            rdp->realm_mkey.enctype);
+           if (rdp->realm_mkey.enctype)
+               krb5_use_enctype(rdp->realm_context, &rdp->realm_encblock, 
+                                rdp->realm_mkey.enctype);
 
            /*
             * Get the master key.