]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
re-do:
authorMark Andrews <marka@isc.org>
Mon, 14 Jan 2002 04:16:03 +0000 (04:16 +0000)
committerMark Andrews <marka@isc.org>
Mon, 14 Jan 2002 04:16:03 +0000 (04:16 +0000)
1168.   [bug]           Empty also-notify clauses were not handled. [RT #2309]

CHANGES
bin/named/config.c
bin/named/lwresd.c
bin/named/zoneconf.c
lib/bind9/check.c

diff --git a/CHANGES b/CHANGES
index 5e142a2b572448319a8df50e81fd8f40ca674bf6..059ad0b733d742c102ace743b8f466ab03803f65 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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).
 
index 2761f884dd082d0cf73f370c804fd43635568a6a..fec2fd7bf0b1f6ef4345c97deab33961f3e9737f 100644 (file)
@@ -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);
index 884f4fe0ef21fc263cb1f57f44c80592f0f3d628..b0a5f95959061b61c9a9b8dc58305a2828c8469b 100644 (file)
@@ -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;
index c5a5b8e87bb5dfa1da65124ab3c482b5fa787398..e55463dc0c02119410ecfe6d234348f9000c0c4e 100644 (file)
@@ -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
index f92fb6b4bba284a27b4ba08328654f82230f8ad1..33f65a56a90d82b8fff7f179d8e5a85fe11af1b0 100644 (file)
@@ -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);