From 6c095f89f5ac22bb67e9ef6d67b75d77234fea45 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 21 Oct 2024 11:34:32 +1100 Subject: [PATCH 1/2] Fix parsing of hostnames in rndc.conf When DSCP was removed the parsing of hostnames was accidentally broken resulting in an assertion failure. Call cfg_parse_tuple rather than using custom code in parse_sockaddrnameport. --- lib/isccfg/namedconf.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index e6aace10db..cee0036810 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -3715,7 +3715,6 @@ static isc_result_t parse_sockaddrnameport(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { isc_result_t result; - cfg_obj_t *obj = NULL; UNUSED(type); CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING)); @@ -3727,17 +3726,7 @@ parse_sockaddrnameport(cfg_parser_t *pctx, const cfg_type_t *type, CHECK(cfg_parse_sockaddr(pctx, &cfg_type_sockaddr, ret)); } else { - const cfg_tuplefielddef_t *fields = - cfg_type_nameport.of; - CHECK(cfg_create_tuple(pctx, &cfg_type_nameport, &obj)); - CHECK(cfg_parse_obj(pctx, fields[0].type, - &obj->value.tuple[0])); - CHECK(cfg_parse_obj(pctx, fields[1].type, - &obj->value.tuple[1])); - CHECK(cfg_parse_obj(pctx, fields[2].type, - &obj->value.tuple[2])); - *ret = obj; - obj = NULL; + CHECK(cfg_parse_tuple(pctx, &cfg_type_nameport, ret)); } } else { cfg_parser_error(pctx, CFG_LOG_NEAR, @@ -3745,7 +3734,6 @@ parse_sockaddrnameport(cfg_parser_t *pctx, const cfg_type_t *type, return (ISC_R_UNEXPECTEDTOKEN); } cleanup: - CLEANUP_OBJ(obj); return (result); } From 5a78f6b21b26b7c68dc5e38ff10f527ddfc841e9 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 21 Oct 2024 11:43:29 +1100 Subject: [PATCH 2/2] Add regression test for [GL #4991] --- bin/tests/system/_common/rndc.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/tests/system/_common/rndc.conf b/bin/tests/system/_common/rndc.conf index b887ec3eda..26420d5c6a 100644 --- a/bin/tests/system/_common/rndc.conf +++ b/bin/tests/system/_common/rndc.conf @@ -19,3 +19,9 @@ key rndc_key { algorithm hmac-sha256; secret "1234abcd8765"; }; + +/* Regresssion test for [GL #4991] */ +server example.com { + key rndc-key; + addresses { localhost; 127.0.0.1; ::1; }; +};