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

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

src/admin/edit/kdb5_edit.c

index 1871d3eb387ce7c9237c9507face0f2f6b5a41fa..f56af7e76f7abd41e27dba496f49694c090a2145 100644 (file)
@@ -247,20 +247,27 @@ char *kdb5_edit_Init(argc, argv)
     if (!dbname)
        dbname = DEFAULT_KDB_FILE;
 
-    if (!enctypedone)
-       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);
+    if (!enctypedone) {
+       if (manual_mkey)
+           master_keyblock.enctype = DEFAULT_KDC_ENCTYPE;
        else
-           com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, tmp);
-       exit(1);
+           master_keyblock.enctype = NULL;
     }
 
-    krb5_use_enctype(edit_context, &master_encblock, master_keyblock.enctype);
+    if (master_keyblock.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 (cur_realm) {
        if ((retval = krb5_set_default_realm(edit_context, cur_realm))) {