]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1634. [bug] named didn't supply a useful error message when it
authorMark Andrews <marka@isc.org>
Mon, 17 May 2004 06:18:40 +0000 (06:18 +0000)
committerMark Andrews <marka@isc.org>
Mon, 17 May 2004 06:18:40 +0000 (06:18 +0000)
                        detected duplicate views.  [RT #11208]

CHANGES
lib/isccfg/check.c

diff --git a/CHANGES b/CHANGES
index a96bc882178ff264e08d131fffbb2410e39d8575..9e89c1dfaf84eb2d9cd37dd00ebb8306dfe61ad2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 1640.  [bug]           win32: isc_socket_cancel(ISC_SOCKCANCEL_ACCEPT) was
                        incorrectly closing the socket.  [RT #11291]
 
+1634.  [bug]           named didn't supply a useful error message when it
+                       detected duplicate views.  [RT #11208]
+
 1633.  [bug]           named should return NOTIMP to update requests to a
                        slaves without a allow-update-forwarding acl specified.
                        [RT #11331]
index 664a807f7b9a4ceccf94e8a97dff653e9884552d..3e4a40b5fb59e9a9e81dc5563bd3d37896687d4a 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: check.c,v 1.14.2.23 2004/04/16 00:02:00 marka Exp $ */
+/* $Id: check.c,v 1.14.2.24 2004/05/17 06:18:40 marka Exp $ */
 
 #include <config.h>
 
@@ -32,6 +32,7 @@
 #include <isc/util.h>
 
 #include <dns/fixedname.h>
+#include <dns/rdataclass.h>
 
 #include <isccfg/cfg.h>
 #include <isccfg/check.h>
@@ -589,6 +590,7 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
        cfg_listelt_t *velement;
        isc_result_t result = ISC_R_SUCCESS;
        isc_result_t tresult;
+       isc_symtab_t *symtab = NULL;
 
        static const char *builtin[] = { "localhost", "localnets",
                                         "any", "none" };
@@ -622,17 +624,51 @@ cfg_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
                }
        }
 
+       tresult = isc_symtab_create(mctx, 100, NULL, NULL, ISC_TRUE, &symtab);
+       if (tresult != ISC_R_SUCCESS)
+               result = tresult;
        for (velement = cfg_list_first(views);
             velement != NULL;
             velement = cfg_list_next(velement))
        {
                cfg_obj_t *view = cfg_listelt_value(velement);
+               cfg_obj_t *vname = cfg_tuple_get(view, "name");
                cfg_obj_t *voptions = cfg_tuple_get(view, "options");
+               cfg_obj_t *vclassobj = cfg_tuple_get(view, "class");
+               dns_rdataclass_t vclass = dns_rdataclass_in;
+               isc_result_t tresult = ISC_R_SUCCESS;
+               const char *key = cfg_obj_asstring(vname);
+               isc_symvalue_t symvalue;
 
+               if (cfg_obj_isstring(vclassobj)) {
+                       isc_textregion_t r;
+               
+                       DE_CONST(cfg_obj_asstring(vclassobj), r.base);
+                       r.length = strlen(r.base);
+                       tresult = dns_rdataclass_fromtext(&vclass, &r);
+                       if (tresult != ISC_R_SUCCESS)
+                               cfg_obj_log(vclassobj, logctx, ISC_LOG_ERROR,
+                                           "view '%s': invalid class %s",
+                                           cfg_obj_asstring(vname), r.base);
+               }
+               if (tresult == ISC_R_SUCCESS && symtab != NULL) {
+                       symvalue.as_pointer = view;
+                       tresult = isc_symtab_define(symtab, key, vclass,
+                                                   symvalue,
+                                                   isc_symexists_reject);
+                       if (tresult == ISC_R_EXISTS) {
+                               cfg_obj_log(view, logctx, ISC_LOG_ERROR,
+                                           "view '%s': already exists", key);
+                               result = tresult;
+                       } else if (result != ISC_R_SUCCESS)
+                               result = tresult;
+               }
                if (check_viewconf(config, voptions, logctx, mctx)
                    != ISC_R_SUCCESS)
                        result = ISC_R_FAILURE;
        }
+       if (symtab != NULL)
+               isc_symtab_destroy(&symtab);
 
        if (views != NULL && options != NULL) {
                obj = NULL;