]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1203. [func] Report locations of previous acl and zone definitions
authorMark Andrews <marka@isc.org>
Wed, 13 Feb 2002 04:36:52 +0000 (04:36 +0000)
committerMark Andrews <marka@isc.org>
Wed, 13 Feb 2002 04:36:52 +0000 (04:36 +0000)
                        when a duplicate is detected.

CHANGES
lib/bind9/check.c

diff --git a/CHANGES b/CHANGES
index d4033fd5891b8668291d0084d9d29ab69ac15e49..b3f6ac5f2d9e69a0cba1885c6740b2b3ffbddc8f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+1203.  [func]          Report locations of previous acl and zone definitions
+                       when a duplicate is detected.
+
 1202.  [func]          New functions: cfg_obj_line() and cfg_obj_file().
 
 1201.  [bug]           Require that if 'callbacks' is passed to
index 3478acbf3b5be5d1e3ce7176cba68a6d668259e4..76243eb65b07652ba1b1e2226c231179d7a4cd38 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: check.c,v 1.23 2002/02/13 03:56:57 marka Exp $ */
+/* $Id: check.c,v 1.24 2002/02/13 04:36:52 marka Exp $ */
 
 #include <config.h>
 
@@ -252,14 +252,27 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab,
                key = isc_mem_strdup(mctx, namebuf);
                if (key == NULL)
                        return (ISC_R_NOMEMORY);
-               symvalue.as_pointer = NULL;
+               symvalue.as_pointer = zconfig;
                tresult = isc_symtab_define(symtab, key,
                                            ztype == HINTZONE ? 1 : 2,
                                            symvalue, isc_symexists_reject);
                if (tresult == ISC_R_EXISTS) {
+                       const char *file;
+                       unsigned int line;
+
+                       RUNTIME_CHECK(isc_symtab_lookup(symtab, key,
+                                           ztype == HINTZONE ? 1 : 2,
+                                           &symvalue) == ISC_R_SUCCESS);
                        isc_mem_free(mctx, key);
+                       file = cfg_obj_file(symvalue.as_pointer);
+                       line = cfg_obj_line(symvalue.as_pointer);
+
+                       if (file == NULL)
+                               file = "<unknown file>";
                        cfg_obj_log(zconfig, logctx, ISC_LOG_ERROR,
-                                   "zone '%s': already exists ", zname);
+                                   "zone '%s': already exists "
+                                   "previous definition: %s:%u",
+                                   zname, file, line);
                        result = ISC_R_FAILURE;
                } else if (tresult != ISC_R_SUCCESS) {
                        isc_mem_strdup(mctx, key);