Commit b6273568 authored by Mark Andrews's avatar Mark Andrews
Browse files

re-do:

1168.   [bug]           Empty also-notify clauses were not handled. [RT #2309]
parent e9472e9f
......@@ -20,8 +20,7 @@
1169. [func] Identify recursive queries in the query log.
1168. [bug] Empty also-notify clauses were not handled gracefully.
[RT #2309]
1168. [bug] Empty also-notify clauses were not handled. [RT #2309]
1167. [contrib] nslint-2.1a3 (from author).
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.24 2002/01/04 02:32:00 gson Exp $ */
/* $Id: config.c,v 1.25 2002/01/14 04:16:00 marka Exp $ */
#include <config.h>
......@@ -249,10 +249,14 @@ ns_config_getiplist(cfg_obj_t *config, cfg_obj_t *list,
isc_result_t result;
INSIST(addrsp != NULL && *addrsp == NULL);
INSIST(countp != NULL && *addrsp == 0);
addrlist = cfg_tuple_get(list, "addresses");
count = ns_config_listcount(addrlist);
if (count == 0)
return (ISC_R_SUCCESS);
portobj = cfg_tuple_get(list, "port");
if (cfg_obj_isuint32(portobj)) {
isc_uint32_t val = cfg_obj_asuint32(portobj);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwresd.c,v 1.40 2002/01/04 02:32:02 gson Exp $ */
/* $Id: lwresd.c,v 1.41 2002/01/14 04:15:59 marka Exp $ */
/*
* Main program for the Lightweight Resolver Daemon.
......@@ -776,7 +776,7 @@ ns_lwresd_configure(isc_mem_t *mctx, cfg_obj_t *config) {
ns_lwresd_t *lwresd;
in_port_t port;
isc_sockaddr_t *addrs = NULL;
isc_uint32_t count;
isc_uint32_t count = 0;
lwres = cfg_listelt_value(element);
lwresd = NULL;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.97 2001/11/30 01:58:52 gson Exp $ */
/* $Id: zoneconf.c,v 1.98 2002/01/14 04:16:01 marka Exp $ */
#include <config.h>
......@@ -439,14 +439,15 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
result = ns_config_get(maps, "also-notify", &obj);
if (result == ISC_R_SUCCESS) {
isc_sockaddr_t *addrs = NULL;
isc_uint32_t addrcount;
isc_uint32_t addrcount = 0;
result = ns_config_getiplist(config, obj, 0, mctx,
&addrs, &addrcount);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_zone_setalsonotify(zone, addrs,
addrcount);
ns_config_putiplist(mctx, &addrs, addrcount);
if (addrs != NULL)
ns_config_putiplist(mctx, &addrs, addrcount);
if (result != ISC_R_SUCCESS)
return (result);
} else
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: check.c,v 1.13 2001/12/29 04:49:51 marka Exp $ */
/* $Id: check.c,v 1.14 2002/01/14 04:15:58 marka Exp $ */
#include <config.h>
......@@ -57,7 +57,7 @@ typedef struct {
} intervaltable;
static isc_result_t
check_options(cfg_obj_t *options, isc_log_t *logctx) {
check_options(cfg_obj_t *options, isc_log_t *logctx, isc_boolean_t toplevel) {
isc_result_t result = ISC_R_SUCCESS;
unsigned int i;
cfg_obj_t *obj = NULL;
......@@ -102,12 +102,22 @@ check_options(cfg_obj_t *options, isc_log_t *logctx) {
(void)cfg_map_get(options, "also-notify", &obj);
if (obj != NULL) {
cfg_obj_t *addrlist = NULL;
cfg_obj_t *port = NULL;
addrlist = cfg_tuple_get(obj, "addresses");
port = cfg_tuple_get(obj, "port");
if (cfg_list_first(addrlist) == NULL) {
cfg_obj_log(options, logctx, ISC_LOG_ERROR,
"empty 'also-notify' entry");
if (result == ISC_R_SUCCESS)
result = ISC_R_FAILURE;
if (toplevel) {
cfg_obj_log(options, logctx, ISC_LOG_ERROR,
"empty 'also-notify' entry");
if (result == ISC_R_SUCCESS)
result = ISC_R_FAILURE;
} else if (cfg_obj_isuint32(port)) {
cfg_obj_log(options, logctx, ISC_LOG_ERROR,
"port specified with "
"empty 'also-notify'");
if (result == ISC_R_SUCCESS)
result = ISC_R_FAILURE;
}
}
}
return (result);
......@@ -347,7 +357,7 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab,
/*
* Check various options.
*/
tresult = check_options(zoptions, logctx);
tresult = check_options(zoptions, logctx, ISC_FALSE);
if (tresult != ISC_R_SUCCESS)
result = tresult;
......@@ -487,9 +497,9 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, dns_rdataclass_t vclass,
}
if (vconfig != NULL)
tresult = check_options(vconfig, logctx);
tresult = check_options(vconfig, logctx, ISC_FALSE);
else
tresult = check_options(config, logctx);
tresult = check_options(config, logctx, ISC_TRUE);
if (tresult != ISC_R_SUCCESS)
result = tresult;
......@@ -509,7 +519,7 @@ bind9_check_namedconf(cfg_obj_t *config, isc_log_t *logctx, isc_mem_t *mctx) {
(void)cfg_map_get(config, "options", &options);
if (options != NULL &&
check_options(options, logctx) != ISC_R_SUCCESS)
check_options(options, logctx, ISC_TRUE) != ISC_R_SUCCESS)
result = ISC_R_FAILURE;
(void)cfg_map_get(config, "view", &views);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment