From 7457bbd82fa701ee78f709cd157436e6878b43d1 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 17 Mar 2000 00:00:18 +0000 Subject: [PATCH] secroots is now a keytable; add trustedkeys keytable --- lib/dns/include/dns/view.h | 3 ++- lib/dns/view.c | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index c2af20abbd..fdbfb33fba 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -83,7 +83,8 @@ struct dns_view { dns_cache_t * cache; dns_db_t * cachedb; dns_db_t * hints; - dns_rbt_t * secroots; + dns_keytable_t * secroots; + dns_keytable_t * trustedkeys; isc_mutex_t lock; isc_rwlock_t conflock; isc_boolean_t frozen; diff --git a/lib/dns/view.c b/lib/dns/view.c index 169f0be431..27ff4c0a12 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -96,14 +97,23 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, goto cleanup_rwlock; } view->secroots = NULL; - result = dns_rbt_create(mctx, NULL, NULL, &view->secroots); + result = dns_keytable_create(mctx, &view->secroots); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, - "dns_rbt_create() failed: %s", + "dns_keytable_create() failed: %s", isc_result_totext(result)); result = ISC_R_UNEXPECTED; goto cleanup_zt; } + view->trustedkeys = NULL; + result = dns_keytable_create(mctx, &view->trustedkeys); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "dns_keytable_create() failed: %s", + isc_result_totext(result)); + result = ISC_R_UNEXPECTED; + goto cleanup_secroots; + } view->cache = NULL; view->cachedb = NULL; @@ -120,7 +130,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->dynamickeys = NULL; result = dns_tsigkeyring_create(view->mctx, &view->dynamickeys); if (result != DNS_R_SUCCESS) - goto cleanup_secroots; + goto cleanup_trustedkeys; view->peers = NULL; result = dns_peerlist_new(view->mctx, &view->peers); if (result != DNS_R_SUCCESS) @@ -141,8 +151,11 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, cleanup_dynkeys: dns_tsigkeyring_destroy(&view->dynamickeys); + cleanup_trustedkeys: + dns_keytable_detach(&view->trustedkeys); + cleanup_secroots: - dns_rbt_destroy(&view->secroots); + dns_keytable_detach(&view->secroots); cleanup_zt: dns_zt_detach(&view->zonetable); @@ -209,7 +222,8 @@ destroy(dns_view_t *view) { if (view->cache != NULL) dns_cache_detach(&view->cache); dns_zt_detach(&view->zonetable); - dns_rbt_destroy(&view->secroots); + dns_keytable_detach(&view->trustedkeys); + dns_keytable_detach(&view->secroots); isc_mutex_destroy(&view->lock); isc_mem_free(view->mctx, view->name); isc_mem_put(view->mctx, view, sizeof *view);