2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

586. [bug] multiple views with the same name were fatal. [RT #516]

This commit is contained in:
Mark Andrews 2000-12-01 09:03:44 +00:00
parent a9dcc1d0cb
commit 4c08b67a5f
4 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,5 @@
586. [bug] multiple views with the same name were fatal. [RT #516]
585. [func] dns_db_addrdataset() and and dns_rdataslab_merge()
now support 'exact' additions in a similar manner to
dns_db_subtractrdataset() and dns_rdataslab_subtract().

View File

@ -33,7 +33,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: confparser.y.dirty,v 1.32 2000/11/25 02:43:48 marka Exp $ */
/* $Id: confparser.y.dirty,v 1.33 2000/12/01 09:03:41 marka Exp $ */
#include <config.h>
@ -3692,7 +3692,13 @@ view_stmt: L_VIEW any_string optional_class L_LBRACE
YYABORT;
}
dns_c_viewtable_addview(currcfg->views, view);
tmpres = dns_c_viewtable_addview(currcfg->views, view);
if (tmpres == ISC_R_EXISTS) {
dns_c_view_delete(&view);
parser_error(ISC_FALSE,
"view '%s' already exists", $2);
YYABORT;
}
dns_c_ctx_setcurrview(currcfg, view);
isc_mem_free(memctx, $2);

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: confview.c,v 1.59 2000/11/28 05:24:51 marka Exp $ */
/* $Id: confview.c,v 1.60 2000/12/01 09:03:42 marka Exp $ */
#include <config.h>
@ -275,12 +275,24 @@ dns_c_viewtable_print(FILE *fp, int indent,
}
void
isc_result_t
dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view) {
dns_c_view_t *elem;
REQUIRE(DNS_C_VIEWTABLE_VALID(viewtable));
REQUIRE(DNS_C_VIEW_VALID(view));
elem = ISC_LIST_HEAD(viewtable->views);
while (elem != NULL) {
if (strcmp(view->name, elem->name) == 0) {
return (ISC_R_EXISTS);
}
elem = ISC_LIST_NEXT(elem, next);
}
ISC_LIST_APPEND(viewtable->views, view, next);
return (ISC_R_SUCCESS);
}
@ -299,7 +311,6 @@ isc_result_t
dns_c_viewtable_clear(dns_c_viewtable_t *table) {
dns_c_view_t *elem;
dns_c_view_t *tmpelem;
isc_result_t r;
REQUIRE(DNS_C_VIEWTABLE_VALID(table));
@ -308,15 +319,7 @@ dns_c_viewtable_clear(dns_c_viewtable_t *table) {
tmpelem = ISC_LIST_NEXT(elem, next);
ISC_LIST_UNLINK(table->views, elem, next);
r = dns_c_view_delete(&elem);
if (r != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_CRITICAL,
"failed to delete view");
return (r);
}
dns_c_view_delete(&elem);
elem = tmpelem;
}
@ -830,7 +833,7 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view) {
isc_result_t
void
dns_c_view_delete(dns_c_view_t **viewptr) {
dns_c_view_t *view;
@ -943,8 +946,6 @@ dns_c_view_delete(dns_c_view_t **viewptr) {
view->magic = 0;
isc_mem_put(view->mem, view, sizeof *view);
return (ISC_R_SUCCESS);
}

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: confview.h,v 1.44 2000/11/25 02:43:54 marka Exp $ */
/* $Id: confview.h,v 1.45 2000/12/01 09:03:44 marka Exp $ */
#ifndef DNS_CONFVIEW_H
#define DNS_CONFVIEW_H 1
@ -192,7 +192,8 @@ isc_result_t dns_c_viewtable_new(isc_mem_t *mem,
isc_result_t dns_c_viewtable_delete(dns_c_viewtable_t **viewtable);
void dns_c_viewtable_print(FILE *fp, int indent, dns_c_viewtable_t *table);
void dns_c_viewtable_addview(dns_c_viewtable_t *viewtable, dns_c_view_t *view);
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);
isc_result_t dns_c_viewtable_viewbyname(dns_c_viewtable_t *viewtable,
@ -215,7 +216,7 @@ isc_result_t dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable);
isc_result_t dns_c_view_new(isc_mem_t *mem, const char *name,
dns_rdataclass_t viewclass,
dns_c_view_t **newview);
isc_result_t dns_c_view_delete(dns_c_view_t **viewptr);
void dns_c_view_delete(dns_c_view_t **viewptr);
void dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view);
isc_boolean_t dns_c_view_keydefinedp(dns_c_view_t *view, const char *keyname);