From: Richard Basch Date: Thu, 11 Jan 1996 12:05:07 +0000 (+0000) Subject: Set the enctype to ENCTYPE_UNKNOWN when the enctype should be determined from X-Git-Tag: krb5-1.0-beta6~628 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06464ee3e73fd75c670066acbb855c2319b77e4b;p=krb5.git Set the enctype to ENCTYPE_UNKNOWN when the enctype should be determined from the stash file. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7306 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/admin/edit/kdb5_edit.c b/src/admin/edit/kdb5_edit.c index 838d44f20..b6e92d7a5 100644 --- a/src/admin/edit/kdb5_edit.c +++ b/src/admin/edit/kdb5_edit.c @@ -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, diff --git a/src/kadmin/v5server/srv_key.c b/src/kadmin/v5server/srv_key.c index 25e709833..e0910e61c 100644 --- a/src/kadmin/v5server/srv_key.c +++ b/src/kadmin/v5server/srv_key.c @@ -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))) diff --git a/src/kdc/main.c b/src/kdc/main.c index 27c38c66f..c2671388a 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -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;