diff --git a/CHANGES b/CHANGES index d4033fd589..b3f6ac5f2d 100644 --- 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 diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 3478acbf3b..76243eb65b 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -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 @@ -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 = ""; 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);