diff --git a/lib/dns/keymgr.c b/lib/dns/keymgr.c index bae21437bd..6b56d5da8f 100644 --- a/lib/dns/keymgr.c +++ b/lib/dns/keymgr.c @@ -2022,6 +2022,20 @@ keymgr_purge_keyfile(dst_key_t *key, int type) { } } +static bool +dst_key_doublematch(dns_dnsseckey_t *key, dns_kasp_t *kasp) { + int matches = 0; + + for (dns_kasp_key_t *kkey = ISC_LIST_HEAD(dns_kasp_keys(kasp)); + kkey != NULL; kkey = ISC_LIST_NEXT(kkey, link)) + { + if (dns_kasp_key_match(kkey, key)) { + matches++; + } + } + return matches > 1; +} + /* * Examine 'keys' and match 'kasp' policy. * @@ -2161,6 +2175,7 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass, * matches the kasp policy. */ if (!dst_key_is_unused(dkey->key) && + !dst_key_doublematch(dkey, kasp) && (dst_key_goal(dkey->key) == OMNIPRESENT) && !keymgr_dep(dkey->key, keyring,