From: Evan Hunt Date: Tue, 11 Aug 2026 00:18:38 +0000 (-0700) Subject: Check for empty 'endpoints' list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94f2c74fd3a07444bcb03ebe9d0103e167bc705c;p=thirdparty%2Fbind9.git Check for empty 'endpoints' list Configuring an http block with "endpoints {};" previously caused a crash in named. This is now rejected earlier by the configuration check. --- diff --git a/bin/tests/system/checkconf/bad-empty-endpoints.conf b/bin/tests/system/checkconf/bad-empty-endpoints.conf new file mode 100644 index 00000000000..caf1823bbfb --- /dev/null +++ b/bin/tests/system/checkconf/bad-empty-endpoints.conf @@ -0,0 +1,4 @@ +http local { endpoints { }; }; +options { + listen-on port 10080 tls none http local { 127.0.0.1; }; +}; diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c index 3c7af5e2c8e..5c85f426e02 100644 --- a/lib/isccfg/check.c +++ b/lib/isccfg/check.c @@ -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;