From: Alan T. DeKok Date: Fri, 30 Aug 2024 17:58:34 +0000 (-0400) Subject: local variables can't be list refs or request refs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04ee87dd95acdf06ca7e5b785569c24641fb0ff;p=thirdparty%2Ffreeradius-server.git local variables can't be list refs or request refs --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index e22864b5e1..8d2fff0d6c 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -1614,12 +1614,25 @@ static unlang_t *compile_edit_pair(unlang_t *parent, unlang_compile_t *unlang_ct static int define_local_variable(CONF_ITEM *ci, unlang_variable_t *var, tmpl_rules_t *t_rules, fr_type_t type, char const *name) { fr_dict_attr_t const *da; + fr_slen_t len; fr_dict_attr_flags_t flags = { .internal = true, .local = true, }; + /* + * Deny names which overlap other concepts. + */ + if (fr_table_value_by_str(tmpl_request_ref_table, name, REQUEST_UNKNOWN) != REQUEST_UNKNOWN) { + fail_list: + cf_log_err(ci, "Local variable '%s' cannot be a list reference.", name); + return -1; + } + + len = strlen(name); + if (tmpl_attr_list_from_substr(&da, &FR_SBUFF_IN(name, len)) == len) goto fail_list; + /* * No overlap with the protocol dictionary. The lookup * in var->root will also check the protocol dictionary,