Fixes for updates of KADM5_KVNO but not KEY_DATA and vice-versa.
It turns out that updates of kvno but not key data and vice-versa are both, allowed and actually done (e.g, in kadmin's ank). Doing the right thing in these cases turns out to be a bit tricky, but this commit ought to do it.
This commit is contained in:
@@ -160,6 +160,12 @@ add_one_principal (const char *name,
|
||||
kadm5_get_principal(kadm_handle, princ_ent, &princ,
|
||||
KADM5_PRINCIPAL | KADM5_KVNO | KADM5_ATTRIBUTES);
|
||||
princ.attributes &= (~KRB5_KDB_DISALLOW_ALL_TIX);
|
||||
/*
|
||||
* Updating kvno w/o key data and vice-versa gives _kadm5_setup_entry()
|
||||
* and _kadm5_set_keys2() headaches. But we used to, so we handle
|
||||
* this in in those two functions. Might as well leave this code as
|
||||
* it was then.
|
||||
*/
|
||||
princ.kvno = 1;
|
||||
kadm5_modify_principal(kadm_handle, &princ,
|
||||
KADM5_ATTRIBUTES | KADM5_KVNO);
|
||||
|
@@ -106,6 +106,10 @@ del_enctype(void *opt, int argc, char **argv)
|
||||
}
|
||||
|
||||
free (princ.key_data);
|
||||
if (j == 0) {
|
||||
free(new_key_data);
|
||||
new_key_data = NULL;
|
||||
}
|
||||
princ.n_key_data = j;
|
||||
princ.key_data = new_key_data;
|
||||
|
||||
|
@@ -60,7 +60,7 @@ static struct field_name {
|
||||
{ "last_failed", KADM5_LAST_FAILED, 0, 0, "Last fail", "Last failed login", 0 },
|
||||
{ "fail_auth_count", KADM5_FAIL_AUTH_COUNT, 0, 0, "Fail count", "Failed login count", RTBL_ALIGN_RIGHT },
|
||||
{ "policy", KADM5_POLICY, 0, 0, "Policy", "Policy", 0 },
|
||||
{ "keytypes", KADM5_KEY_DATA, 0, KADM5_PRINCIPAL, "Keytypes", "Keytypes", 0 },
|
||||
{ "keytypes", KADM5_KEY_DATA, 0, KADM5_PRINCIPAL | KADM5_KVNO, "Keytypes", "Keytypes", 0 },
|
||||
{ "password", KADM5_TL_DATA, KRB5_TL_PASSWORD, KADM5_KEY_DATA, "Password", "Password", 0 },
|
||||
{ "pkinit-acl", KADM5_TL_DATA, KRB5_TL_PKINIT_ACL, 0, "PK-INIT ACL", "PK-INIT ACL", 0 },
|
||||
{ "aliases", KADM5_TL_DATA, KRB5_TL_ALIASES, 0, "Aliases", "Aliases", 0 },
|
||||
|
Reference in New Issue
Block a user