]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
local variables can't be list refs or request refs
authorAlan T. DeKok <aland@freeradius.org>
Fri, 30 Aug 2024 17:58:34 +0000 (13:58 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 30 Aug 2024 17:58:34 +0000 (13:58 -0400)
src/lib/unlang/compile.c

index e22864b5e1f3d61b3183d85a5f34e79b2505ff68..8d2fff0d6c5560d94aa4d54eb4874b19413a7323 100644 (file)
@@ -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,