From ad70a097c8f874389fbab0333d373030bcb7e3d9 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 1 Dec 2000 23:27:43 +0000 Subject: [PATCH] Allow views w/ same name and different class to be added to view list. Change view add failure result test from == ISC_R_EXISTS -> != ISC_R_SUCCESS. --- lib/dns/config/confparser.y.dirty | 4 ++-- lib/dns/config/confview.c | 13 +++++-------- lib/dns/include/dns/confview.h | 6 +++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/dns/config/confparser.y.dirty b/lib/dns/config/confparser.y.dirty index 410d52cac4..29ba756bcf 100644 --- a/lib/dns/config/confparser.y.dirty +++ b/lib/dns/config/confparser.y.dirty @@ -33,7 +33,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confparser.y.dirty,v 1.33 2000/12/01 09:03:41 marka Exp $ */ +/* $Id: confparser.y.dirty,v 1.34 2000/12/01 23:27:40 marka Exp $ */ #include @@ -3693,7 +3693,7 @@ view_stmt: L_VIEW any_string optional_class L_LBRACE } tmpres = dns_c_viewtable_addview(currcfg->views, view); - if (tmpres == ISC_R_EXISTS) { + if (tmpres != ISC_R_SUCCESS) { dns_c_view_delete(&view); parser_error(ISC_FALSE, "view '%s' already exists", $2); diff --git a/lib/dns/config/confview.c b/lib/dns/config/confview.c index 2c1630b1f8..7e6df8098a 100644 --- a/lib/dns/config/confview.c +++ b/lib/dns/config/confview.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confview.c,v 1.61 2000/12/01 19:50:52 gson Exp $ */ +/* $Id: confview.c,v 1.62 2000/12/01 23:27:42 marka Exp $ */ #include @@ -235,7 +235,7 @@ dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable) { } -isc_result_t +void dns_c_viewtable_delete(dns_c_viewtable_t **viewtable) { dns_c_viewtable_t *table; @@ -249,8 +249,6 @@ dns_c_viewtable_delete(dns_c_viewtable_t **viewtable) { table->magic = 0; isc_mem_put(table->mem, table, sizeof *table); - - return (ISC_R_SUCCESS); } @@ -284,7 +282,8 @@ dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) { elem = ISC_LIST_HEAD(viewtable->views); while (elem != NULL) { - if (strcmp(view->name, elem->name) == 0) { + if (strcmp(view->name, elem->name) == 0 && + view->viewclass == elem->viewclass) { return (ISC_R_EXISTS); } @@ -307,7 +306,7 @@ dns_c_viewtable_rmview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) { -isc_result_t +void dns_c_viewtable_clear(dns_c_viewtable_t *table) { dns_c_view_t *elem; dns_c_view_t *tmpelem; @@ -322,8 +321,6 @@ dns_c_viewtable_clear(dns_c_viewtable_t *table) { dns_c_view_delete(&elem); elem = tmpelem; } - - return (ISC_R_SUCCESS); } diff --git a/lib/dns/include/dns/confview.h b/lib/dns/include/dns/confview.h index 4f2e54e3b9..9d3a1b036a 100644 --- a/lib/dns/include/dns/confview.h +++ b/lib/dns/include/dns/confview.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confview.h,v 1.45 2000/12/01 09:03:44 marka Exp $ */ +/* $Id: confview.h,v 1.46 2000/12/01 23:27:43 marka Exp $ */ #ifndef DNS_CONFVIEW_H #define DNS_CONFVIEW_H 1 @@ -189,13 +189,13 @@ ISC_LANG_BEGINDECLS isc_result_t dns_c_viewtable_new(isc_mem_t *mem, dns_c_viewtable_t **viewtable); -isc_result_t dns_c_viewtable_delete(dns_c_viewtable_t **viewtable); +void dns_c_viewtable_delete(dns_c_viewtable_t **viewtable); void dns_c_viewtable_print(FILE *fp, int indent, dns_c_viewtable_t *table); isc_result_t dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view); void dns_c_viewtable_rmview(dns_c_viewtable_t *viewtable, dns_c_view_t *view); -isc_result_t dns_c_viewtable_clear(dns_c_viewtable_t *table); +void dns_c_viewtable_clear(dns_c_viewtable_t *table); isc_result_t dns_c_viewtable_viewbyname(dns_c_viewtable_t *viewtable, const char *viewname, dns_c_view_t **retval);