From: Alan T. DeKok Date: Mon, 4 Sep 2023 19:54:14 +0000 (-0400) Subject: If we have a LHS leaf, pass it to the RHS tmpl parser X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f9626040a66a732117d68e5bc8abe12c3351e06;p=thirdparty%2Ffreeradius-server.git If we have a LHS leaf, pass it to the RHS tmpl parser which means that we catch more load-time errors for typos in the configuration files. and add test case. The RHS resolution is done in pass2, so there's no issue with an enum name being defined after the configuration files have been read. --- diff --git a/src/lib/server/map.c b/src/lib/server/map.c index e3cc8cedf58..81e311c1dc3 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -190,8 +190,13 @@ int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, map_t *parent, CONF_PAIR *cp, */ if (!input_rhs_rules) { tmpl_rules_child_init(child_ctx, &my_rhs_rules, lhs_rules, map->lhs); - rhs_rules = &my_rhs_rules; + } else { + my_rhs_rules = *input_rhs_rules; } + rhs_rules = &my_rhs_rules; + + da = tmpl_attr_tail_da(map->lhs); + if (edit && fr_type_is_leaf(da->type)) my_rhs_rules.enumv = tmpl_attr_tail_da(map->lhs); break; } diff --git a/src/tests/keywords/edit-rhs-error b/src/tests/keywords/edit-rhs-error new file mode 100644 index 00000000000..1a011ade6b1 --- /dev/null +++ b/src/tests/keywords/edit-rhs-error @@ -0,0 +1,4 @@ +# +# The RHS isn't a number or an enum +# +&Tmp-Integer-0 := '$[3][2]' # ERROR \ No newline at end of file