From 37573cd7a4478474a1c1acb98beeac665c73885c Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Wed, 14 Feb 1996 14:55:34 +0000 Subject: [PATCH] * kdb5_edit.c (enter_master_key, set_dbname_help): If master key enctype is unknown, set to DEFAULT_KDC_ENCTYPE. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7478 dc483132-0cff-0310-8789-dd5450dbe970 --- src/admin/edit/ChangeLog | 5 ++++ src/admin/edit/kdb5_edit.c | 58 ++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/admin/edit/ChangeLog b/src/admin/edit/ChangeLog index 1d739401c..bd2682297 100644 --- a/src/admin/edit/ChangeLog +++ b/src/admin/edit/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 14 09:52:18 1996 Ezra Peisach + + * kdb5_edit.c (enter_master_key, set_dbname_help): If master key + enctype is unknown, set to DEFAULT_KDC_ENCTYPE. + Tue Feb 13 16:08:07 1996 Ezra Peisach * kdb5_edit.c (extract_v4_srvtab): krb5_dbekd_decrypt_key_data diff --git a/src/admin/edit/kdb5_edit.c b/src/admin/edit/kdb5_edit.c index fd8740b5b..ea3d0c852 100644 --- a/src/admin/edit/kdb5_edit.c +++ b/src/admin/edit/kdb5_edit.c @@ -255,17 +255,17 @@ char *kdb5_edit_Init(argc, argv) } if (master_keyblock.enctype != ENCTYPE_UNKNOWN) { - 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, + 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); } @@ -479,6 +479,24 @@ set_dbname_help(pname, dbname) com_err(pname, retval, "while calculated master key salt"); return(1); } + + /* If no encryption type is set, use the default */ + if (master_keyblock.enctype == ENCTYPE_UNKNOWN) { + 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(pname, KRB5_PROG_KEYTYPE_NOSUPP, + "while setting up enctype %d", master_keyblock.enctype); + else + com_err(pname, KRB5_PROG_KEYTYPE_NOSUPP, tmp); + exit(1); + } + krb5_use_enctype(edit_context, &master_encblock, + master_keyblock.enctype); + } + retval = krb5_string_to_key(edit_context, &master_encblock, &master_keyblock, &pwd, &scratch); if (retval) { @@ -557,7 +575,25 @@ void enter_master_key(argc, argv) master_keyblock.length); krb5_xfree(master_keyblock.contents); master_keyblock.contents = NULL; + valid_master_key = 0; } + + if (master_keyblock.enctype == ENCTYPE_UNKNOWN) { + 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); + else + com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, tmp); + exit(1); + } + krb5_use_enctype(edit_context, &master_encblock, + master_keyblock.enctype); + } + if ((retval = krb5_db_fetch_mkey(edit_context, master_princ, &master_encblock, TRUE, FALSE, (char *) NULL, -- 2.26.2