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,
/*
* 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);
/*
}
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,
*/
if ((kret = krb5_string_to_key(argp->context,
&master_encblock,
- kdata->key_data_type[0],
&key,
argp->string,
&salt)))
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;
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;