Commit 40aadb6a authored by Mark Andrews's avatar Mark Andrews

2179. [func] 'rndc command zone' will now find 'zone' if it is

                        unique to all the views. [RT #16821]
parent 65b26a4d
2179. [func] 'rndc command zone' will now find 'zone' if it is
unique to all the views. [RT #16821]
2178. [bug] 'rndc reload' of a slave or stub zone resulted in
a reference leak. [RT #16867]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.484 2007/05/15 02:28:27 marka Exp $ */
/* $Id: server.c,v 1.485 2007/05/15 02:38:34 marka Exp $ */
/*! \file */
......@@ -4124,23 +4124,28 @@ zone_from_args(ns_server_t *server, char *args, dns_zone_t **zonep) {
result = dns_rdataclass_fromtext(&rdclass, &r);
if (result != ISC_R_SUCCESS)
goto fail1;
} else {
} else
rdclass = dns_rdataclass_in;
}
if (viewtxt == NULL)
viewtxt = "_default";
result = dns_viewlist_find(&server->viewlist, viewtxt,
rdclass, &view);
if (result != ISC_R_SUCCESS)
goto fail1;
if (viewtxt == NULL) {
result = dns_viewlist_findzone(&server->viewlist,
dns_fixedname_name(&name),
ISC_TF(classtxt == NULL),
rdclass, zonep);
} else {
result = dns_viewlist_find(&server->viewlist, viewtxt,
rdclass, &view);
if (result != ISC_R_SUCCESS)
goto fail1;
result = dns_zt_find(view->zonetable, dns_fixedname_name(&name),
0, NULL, zonep);
result = dns_zt_find(view->zonetable, dns_fixedname_name(&name),
0, NULL, zonep);
dns_view_detach(&view);
}
/* Partial match? */
if (result != ISC_R_SUCCESS && *zonep != NULL)
dns_zone_detach(zonep);
dns_view_detach(&view);
fail1:
return (result);
}
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.h,v 1.105 2007/03/29 23:47:04 tbox Exp $ */
/* $Id: view.h,v 1.106 2007/05/15 02:38:34 marka Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
......@@ -594,6 +594,19 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name,
*\li #ISC_R_NOTFOUND No matching view was found.
*/
isc_result_t
dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses,
dns_rdataclass_t rdclass, dns_zone_t **zonep);
/*%<
* Search zone with 'name' in view with 'rdclass' in viewlist 'list'
* If found, zone is returned in *zonep. If allclasses is set rdclass is ignored
*
* Returns:
*\li #ISC_R_SUCCESS A matching zone was found.
*\li #ISC_R_NOTFOUND No matching zone was found.
*/
isc_result_t
dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep);
/*%<
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.c,v 1.141 2007/03/29 06:36:30 marka Exp $ */
/* $Id: view.c,v 1.142 2007/05/15 02:38:34 marka Exp $ */
/*! \file */
......@@ -1146,6 +1146,40 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name,
return (ISC_R_SUCCESS);
}
isc_result_t
dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name,
isc_boolean_t allclasses, dns_rdataclass_t rdclass,
dns_zone_t **zonep)
{
dns_view_t *view;
isc_result_t result;
dns_zone_t *zone1 = NULL, *zone2 = NULL;
REQUIRE(list != NULL);
for (view = ISC_LIST_HEAD(*list);
view != NULL;
view = ISC_LIST_NEXT(view, link)) {
if (allclasses == ISC_FALSE && view->rdclass != rdclass)
continue;
result = dns_zt_find(view->zonetable, name, 0, NULL,
(zone1 == NULL) ? &zone1 : &zone2);
INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND);
if (zone2 != NULL) {
dns_zone_detach(&zone1);
dns_zone_detach(&zone2);
return (ISC_R_NOTFOUND);
}
}
if (zone1 != NULL) {
dns_zone_attach(zone1, zonep);
dns_zone_detach(&zone1);
return (ISC_R_SUCCESS);
}
return (ISC_R_NOTFOUND);
}
isc_result_t
dns_view_load(dns_view_t *view, isc_boolean_t stop) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment