mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Add synth-from-dnssec namespaces for keytable entries
We do this by adding callbacks for when a node is added or deleted from the keytable. dns_keytable_add and dns_keytable_delete where extended to take a callback. dns_keytable_deletekey does not remove the node so it was not extended.
This commit is contained in:
@@ -367,7 +367,8 @@ new_keynode(dns_rdata_ds_t *ds, dns_keytable_t *keytable, bool managed,
|
||||
*/
|
||||
static isc_result_t
|
||||
insert(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
const dns_name_t *keyname, dns_rdata_ds_t *ds) {
|
||||
const dns_name_t *keyname, dns_rdata_ds_t *ds,
|
||||
dns_keytable_callback_t callback, void *callback_arg) {
|
||||
dns_rbtnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
|
||||
@@ -384,6 +385,9 @@ insert(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
* and attach it to the created node.
|
||||
*/
|
||||
node->data = new_keynode(ds, keytable, managed, initial);
|
||||
if (callback != NULL) {
|
||||
(*callback)(keyname, callback_arg);
|
||||
}
|
||||
} else if (result == ISC_R_EXISTS) {
|
||||
/*
|
||||
* A node already exists for "keyname" in "keytable".
|
||||
@@ -393,6 +397,9 @@ insert(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
if (knode == NULL) {
|
||||
node->data = new_keynode(ds, keytable, managed,
|
||||
initial);
|
||||
if (callback != NULL) {
|
||||
(*callback)(keyname, callback_arg);
|
||||
}
|
||||
} else {
|
||||
add_ds(knode, ds, keytable->mctx);
|
||||
}
|
||||
@@ -407,20 +414,23 @@ insert(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_add(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
dns_name_t *name, dns_rdata_ds_t *ds) {
|
||||
dns_name_t *name, dns_rdata_ds_t *ds,
|
||||
dns_keytable_callback_t callback, void *callback_arg) {
|
||||
REQUIRE(ds != NULL);
|
||||
REQUIRE(!initial || managed);
|
||||
|
||||
return (insert(keytable, managed, initial, name, ds));
|
||||
return (insert(keytable, managed, initial, name, ds, callback,
|
||||
callback_arg));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_marksecure(dns_keytable_t *keytable, const dns_name_t *name) {
|
||||
return (insert(keytable, true, false, name, NULL));
|
||||
return (insert(keytable, true, false, name, NULL, NULL, NULL));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname) {
|
||||
dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname,
|
||||
dns_keytable_callback_t callback, void *callback_arg) {
|
||||
isc_result_t result;
|
||||
dns_rbtnode_t *node = NULL;
|
||||
|
||||
@@ -434,6 +444,9 @@ dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname) {
|
||||
if (node->data != NULL) {
|
||||
result = dns_rbt_deletenode(keytable->table, node,
|
||||
false);
|
||||
if (callback != NULL) {
|
||||
(*callback)(keyname, callback_arg);
|
||||
}
|
||||
} else {
|
||||
result = ISC_R_NOTFOUND;
|
||||
}
|
||||
|
Reference in New Issue
Block a user