}
retval = krb5_db_store_master_key(context, keyfile, master_princ,
- mkey_kvno, &master_keyblock,
- NULL);
+ mkey_kvno, &master_keyblock, NULL);
if (retval) {
com_err(argv[0], errno, "while storing key");
memset((char *)master_keyblock.contents, 0, master_keyblock.length);
.TP
\fB\-kv\fP\ \fImkeyVNO\fP
Specifies the version number of the master key in the database; the default is
-0.
+1. Note that 0 is not allowed.
.TP
\fB\-M\fP\ \fImkeyname\fP
principal name for the master key in the database; the default is
}
if (params_in->mask & KADM5_CONFIG_KVNO) {
- params.kvno = params_in->kvno;
+ params.kvno = params_in->kvno;
params.mask |= KADM5_CONFIG_KVNO;
}
/*
char *krb5_mkey_pwd_prompt2 = KRB5_KDC_MKEY_2;
krb5_error_code
-krb5_db_fetch_mkey(krb5_context context,
- krb5_principal mname,
- krb5_enctype etype,
- krb5_boolean fromkeyboard,
- krb5_boolean twice,
- char * db_args,
- krb5_kvno * kvno,
- krb5_data * salt,
- krb5_keyblock * key)
+krb5_db_fetch_mkey( krb5_context context,
+ krb5_principal mname,
+ krb5_enctype etype,
+ krb5_boolean fromkeyboard,
+ krb5_boolean twice,
+ char * db_args,
+ krb5_kvno * kvno,
+ krb5_data * salt,
+ krb5_keyblock * key)
{
krb5_error_code retval;
char password[BUFSIZ];
}
krb5_error_code
-krb5_db_verify_master_key(krb5_context kcontext,
- krb5_principal mprinc,
- krb5_kvno kvno,
- krb5_keyblock *mkey)
+krb5_db_verify_master_key( krb5_context kcontext,
+ krb5_principal mprinc,
+ krb5_kvno kvno,
+ krb5_keyblock * mkey)
{
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
}
status = dal_handle->lib_handle->vftabl.verify_master_key(kcontext,
- mprinc,
- kvno,
+ mprinc,
+ kvno,
mkey);
get_errmsg(kcontext, status);
kdb_unlock_lib_lock(dal_handle->lib_handle, FALSE);
"Could not create temp keytab file name.");
goto out;
}
+
if (mktemp(tmp_ktname) == NULL) {
retval = errno;
krb5_set_error_message (context, retval,
goto errout;
while ((retval = krb5_kt_next_entry(context, kt, &kt_ent, &cursor)) == 0) {
- if (key->enctype != ENCTYPE_UNKNOWN && key->enctype != kt_ent.key.enctype)
- continue;
- if (kvno != NULL && *kvno != IGNORE_VNO && *kvno != kt_ent.vno)
+
+ if ((key->enctype != ENCTYPE_UNKNOWN && key->enctype != kt_ent.key.enctype) ||
+ (kvno != NULL && *kvno != IGNORE_VNO && *kvno != kt_ent.vno)) {
+
+ krb5_kt_free_entry(context, &kt_ent);
continue;
+ }
break;
}
if (retval != 0) {
if (retval == KRB5_KT_END) {
+ /* didn't find an entry so indicate no key found */
(void) krb5_kt_end_seq_get(context, kt, &cursor);
retval = KRB5_KDB_BADSTORED_MKEY;
}
.TP
\fB\-kv\fP\ \fImkeyVNO\fP
Specifies the version number of the master key in the database; the default is
-0.
+1. Note that 0 is not allowed.
.TP
\fB\-m\fP
Specifies that the master database password should be read from the TTY