]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check for empty 'endpoints' list 12548/head
authorEvan Hunt <each@isc.org>
Tue, 11 Aug 2026 00:18:38 +0000 (17:18 -0700)
committerEvan Hunt <each@isc.org>
Tue, 11 Aug 2026 07:55:41 +0000 (07:55 +0000)
Configuring an http block with "endpoints {};" previously caused
a crash in named. This is now rejected earlier by the configuration
check.

bin/tests/system/checkconf/bad-empty-endpoints.conf [new file with mode: 0644]
lib/isccfg/check.c

diff --git a/bin/tests/system/checkconf/bad-empty-endpoints.conf b/bin/tests/system/checkconf/bad-empty-endpoints.conf
new file mode 100644 (file)
index 0000000..caf1823
--- /dev/null
@@ -0,0 +1,4 @@
+http local { endpoints { }; };
+options {
+       listen-on port 10080 tls none http local { 127.0.0.1; };
+};
index 3c7af5e2c8ee47ad491de13e49b25c9173116ce8..5c85f426e0221a573d3706bd85a9d238a45fd025 100644 (file)
@@ -2218,9 +2218,11 @@ check_httpserver(const cfg_obj_t *http, isc_symtab_t *symtab) {
        /* Check endpoints are valid */
        tresult = cfg_map_get(http, "endpoints", &eps);
        if (tresult == ISC_R_SUCCESS) {
+               bool empty = true;
                CFG_LIST_FOREACH(eps, elt) {
                        const cfg_obj_t *ep = cfg_listelt_value(elt);
                        const char *path = cfg_obj_asstring(ep);
+                       empty = false;
                        if (!isc_nm_http_path_isvalid(path)) {
                                cfg_obj_log(eps, ISC_LOG_ERROR,
                                            "endpoint '%s' is not a "
@@ -2231,6 +2233,13 @@ check_httpserver(const cfg_obj_t *http, isc_symtab_t *symtab) {
                                }
                        }
                }
+               if (empty) {
+                       cfg_obj_log(eps, ISC_LOG_ERROR,
+                                   "empty 'endpoints' entry");
+                       if (result == ISC_R_SUCCESS) {
+                               result = ISC_R_FAILURE;
+                       }
+               }
        }
 
        return result;