]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check for unspecified tails
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Sep 2024 21:17:09 +0000 (17:17 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 10 Sep 2024 12:14:29 +0000 (08:14 -0400)
src/lib/unlang/compile.c

index 70d15b475f9fead3349697193ac608e92e4b6bd9..47567678dc9525aca905d4e5b9d19ec8cc782a8e 100644 (file)
@@ -3312,18 +3312,25 @@ static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx,
        if (type_name) {
                unlang_variable_t *var;
 
-               da = tmpl_attr_tail_da(vpt);
-
                type = fr_table_value_by_str(fr_type_table, type_name, FR_TYPE_VOID);
                fr_assert(type != FR_TYPE_VOID);
 
+               /*
+                *      foreach string foo (&tlv-thing.[*]) { ... }
+                */
+               if (tmpl_attr_tail_is_unspecified(vpt)) {
+                       goto get_name;
+               }
+
+               da = tmpl_attr_tail_da(vpt);
+
                if (type == FR_TYPE_NULL) {
                        type = da->type;
 
                } else if (fr_type_is_leaf(type) != fr_type_is_leaf(da->type)) {
                incompatible:
-                       cf_log_err(cs, "Incompatible data types in foreach variable (%s), and reference being looped over (%s)",
-                                  fr_type_to_str(type), fr_type_to_str(da->type));
+                       cf_log_err(cs, "Incompatible data types in foreach variable (%s), and reference %s being looped over (%s)",
+                                  fr_type_to_str(type), da->name, fr_type_to_str(da->type));
                        goto fail;
 
                } else if (fr_type_is_structural(type) && (type != da->type)) {