An attempt to change the kadmin/history key with the -keepold flag
would leak the KDB entry and keysalt tuple as it returned an error.
Use the cleanup handler instead of returning directly. Reported by
Bean Zhang.
ticket: 8759
tags: pullup
target_version: 1.16-next
target_version: 1.15-next
if (krb5_principal_compare(handle->context, principal, hist_princ)) {
/* If changing the history entry, the new entry must have exactly one
* key. */
- if (keepold)
- return KADM5_PROTECT_PRINCIPAL;
+ if (keepold) {
+ ret = KADM5_PROTECT_PRINCIPAL;
+ goto done;
+ }
new_n_ks_tuple = 1;
}