From: Arran Cudbard-Bell Date: Sun, 18 Feb 2024 17:53:26 +0000 (-0600) Subject: Fix server section search in DNS listener X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bef4b68fdf5f93fa22dd2c4a55bdc80cfbdc5101;p=thirdparty%2Ffreeradius-server.git Fix server section search in DNS listener Currently just throws an assert... --- diff --git a/src/lib/server/cf_util.c b/src/lib/server/cf_util.c index ade648a3e76..26ec045267b 100644 --- a/src/lib/server/cf_util.c +++ b/src/lib/server/cf_util.c @@ -996,6 +996,9 @@ CONF_SECTION *cf_section_find_next(CONF_SECTION const *cs, CONF_SECTION const *p } /** Find a CONF_SECTION with name1 and optionally name2 in the specified conf section of one of its parents + * + * Will walk up the configuration tree, searching in each parent until a matching section is found or + * we hit the root. * * @param[in] cs The section we're searching in. * @param[in] name1 of the section we're searching for. Special value CF_IDENT_ANY diff --git a/src/listen/dns/proto_dns_udp.c b/src/listen/dns/proto_dns_udp.c index 88cc73a24cc..94a1feb533f 100644 --- a/src/listen/dns/proto_dns_udp.c +++ b/src/listen/dns/proto_dns_udp.c @@ -24,6 +24,7 @@ #define LOG_PREFIX "proto_dns_udp" #include +#include #include #include #include @@ -340,7 +341,6 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) proto_dns_udp_t *inst = talloc_get_type_abort(mctx->inst->data, proto_dns_udp_t); CONF_SECTION *conf = mctx->inst->conf; size_t num; - CONF_ITEM *ci; CONF_SECTION *server_cs; fr_client_t *client; @@ -389,12 +389,8 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) } } - ci = cf_parent(inst->cs); /* listen { ... } */ - fr_assert(ci != NULL); - ci = cf_parent(ci); - fr_assert(ci != NULL); - - server_cs = cf_item_to_section(ci); + server_cs = cf_section_find_in_parent(inst->cs, "server", NULL); + fr_assert(server_cs != NULL); /* * Look up local clients, if they exist.