diff --git a/CHANGES b/CHANGES index 6cc866a77e..f7f9673859 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1217. [func] Report locations of previous key definition when a + duplicate is detected. + 1216. [bug] Multiple server clauses for the same server were not reported. [RT #2514] diff --git a/lib/bind9/check.c b/lib/bind9/check.c index f5edb6177b..8c3b7225db 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.27 2002/03/04 05:24:33 marka Exp $ */ +/* $Id: check.c,v 1.28 2002/03/04 05:27:29 marka Exp $ */ #include @@ -419,12 +419,24 @@ check_keylist(cfg_obj_t *keys, isc_symtab_t *symtab, isc_log_t *logctx) { const char *keyname = cfg_obj_asstring(cfg_map_getname(key)); isc_symvalue_t symvalue; - symvalue.as_pointer = NULL; + symvalue.as_pointer = key; tresult = isc_symtab_define(symtab, keyname, 1, symvalue, isc_symexists_reject); if (tresult == ISC_R_EXISTS) { + const char *file; + unsigned int line; + + RUNTIME_CHECK(isc_symtab_lookup(symtab, keyname, + 1, &symvalue) == ISC_R_SUCCESS); + file = cfg_obj_file(symvalue.as_pointer); + line = cfg_obj_line(symvalue.as_pointer); + + if (file == NULL) + file = ""; cfg_obj_log(key, logctx, ISC_LOG_ERROR, - "key '%s': already exists ", keyname); + "key '%s': already exists " + "previous definition: %s:%u", + keyname, file, line); result = tresult; } else if (tresult != ISC_R_SUCCESS) return (tresult);