heimdal
heimdal copied to clipboard
kcm: Deduplicate credentials when storing a new one
Before, when storing a new credential, KCM will only append the new credential and never ever remove duplicates if it's not told to do so.
This allows the credentials stored in a ccache to grow-up indefinitely in some situations. One of them if the usage of "krb5_cc_set_config" (used in gss_acquire_creds). krb5_cc_set_config is called multiple times when the credential is expired, until a valid credential is available. This leads to a huge number of duplicates credentials and, in the end, slows down KCM.
With this commit, duplicate credential are removed and the newest is appended at the end.