From a5125a84b92c5f8437abe08c111226429bbd4f58 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 29 Sep 1992 13:56:47 +0000 Subject: [PATCH] Now allows the user to pass in their own custom salt information for the master key. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2425 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/fetch_mkey.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/kdb/fetch_mkey.c b/src/lib/kdb/fetch_mkey.c index c71a2572d..adfac253c 100644 --- a/src/lib/kdb/fetch_mkey.c +++ b/src/lib/kdb/fetch_mkey.c @@ -67,11 +67,13 @@ krb5_db_fetch_mkey(DECLARG(krb5_principal, mname), DECLARG(krb5_encrypt_block *, eblock), DECLARG(krb5_boolean, fromkeyboard), DECLARG(krb5_boolean, twice), + DECLARG(krb5_data *, salt), DECLARG(krb5_keyblock *,key)) OLDDECLARG(krb5_principal, mname) OLDDECLARG(krb5_encrypt_block *, eblock) OLDDECLARG(krb5_boolean, fromkeyboard) OLDDECLARG(krb5_boolean, twice) +OLDDECLARG(krb5_data *, salt) OLDDECLARG(krb5_keyblock *,key) { krb5_error_code retval; @@ -91,10 +93,15 @@ OLDDECLARG(krb5_keyblock *,key) pwd.data = password; pwd.length = size; - if (retval = krb5_principal2salt(mname, &scratch)) - return retval; - retval = krb5_string_to_key(eblock, key->keytype, key, &pwd, &scratch); - xfree(scratch.data); + if (!salt) { + retval = krb5_principal2salt(mname, &scratch); + if (retval) + return retval; + } + retval = krb5_string_to_key(eblock, key->keytype, key, &pwd, + salt ? salt : &scratch); + if (!salt) + xfree(scratch.data); memset(password, 0, sizeof(password)); /* erase it */ return retval; -- 2.26.2