2739. [cleanup] Clean up API for initializing and clearing trust
anchors for a view. [RT #20211]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: view.c,v 1.156 2009/09/01 00:22:26 jinmei Exp $ */
|
||||
/* $Id: view.c,v 1.157 2009/10/27 22:46:13 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -97,7 +97,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
goto cleanup_mutex;
|
||||
}
|
||||
#endif
|
||||
view->secroots = NULL;
|
||||
view->secroots_priv = NULL;
|
||||
view->fwdtable = NULL;
|
||||
result = dns_fwdtable_create(mctx, &view->fwdtable);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -354,8 +354,8 @@ destroy(dns_view_t *view) {
|
||||
isc_stats_detach(&view->resstats);
|
||||
if (view->resquerystats != NULL)
|
||||
dns_stats_detach(&view->resquerystats);
|
||||
if (view->secroots != NULL)
|
||||
dns_keytable_detach(&view->secroots);
|
||||
if (view->secroots_priv != NULL)
|
||||
dns_keytable_detach(&view->secroots_priv);
|
||||
dns_fwdtable_destroy(&view->fwdtable);
|
||||
dns_aclenv_destroy(&view->aclenv);
|
||||
DESTROYLOCK(&view->lock);
|
||||
@@ -1531,3 +1531,29 @@ dns_view_getresquerystats(dns_view_t *view, dns_stats_t **statsp) {
|
||||
if (view->resquerystats != NULL)
|
||||
dns_stats_attach(view->resquerystats, statsp);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_initsecroots(dns_view_t *view, isc_mem_t *mctx) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
if (view->secroots_priv != NULL)
|
||||
dns_keytable_detach(&view->secroots_priv);
|
||||
return (dns_keytable_create(mctx, &view->secroots_priv));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_getsecroots(dns_view_t *view, dns_keytable_t **ktp) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
REQUIRE(ktp != NULL && *ktp == NULL);
|
||||
if (view->secroots_priv == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
dns_keytable_attach(view->secroots_priv, ktp);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_issecuredomain(dns_view_t *view, dns_name_t *name,
|
||||
isc_boolean_t *secure_domain) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
return (dns_keytable_issecuredomain(view->secroots_priv, name,
|
||||
secure_domain));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user