Now allows the user to pass in their own custom salt information for the
authorTheodore Tso <tytso@mit.edu>
Tue, 29 Sep 1992 13:56:47 +0000 (13:56 +0000)
committerTheodore Tso <tytso@mit.edu>
Tue, 29 Sep 1992 13:56:47 +0000 (13:56 +0000)
master key.

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

src/lib/kdb/fetch_mkey.c

index c71a2572de678bdf2bef27bfc671268b9cfa1d69..adfac253c13a0eeedf4ece165f537311b7f90a4e 100644 (file)
@@ -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;