]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add check that tmpl exands to attr ref when type == FR_TYPE_ATTRIBUTE
authorNick Porter <nick@portercomputing.co.uk>
Thu, 8 Jun 2023 08:41:05 +0000 (09:41 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 8 Jun 2023 18:57:03 +0000 (14:57 -0400)
src/lib/unlang/call_env.c

index 610c3a18dd877b7a21b9fcb1eaede01ed2070e8d..3c2529ae95acae0042c8233d2df2ab4ab2a61c98 100644 (file)
@@ -121,10 +121,18 @@ int call_env_parse(TALLOC_CTX *ctx, call_env_parsed_head_t *parsed, char const *
                         *      Ensure only valid TMPL types are produced.
                         */
                        switch (call_env_parsed->tmpl->type) {
-                       case TMPL_TYPE_ATTR:
                        case TMPL_TYPE_DATA:
                        case TMPL_TYPE_EXEC:
                        case TMPL_TYPE_XLAT:
+                               if (call_env->type & FR_TYPE_ATTRIBUTE) {
+                                       cf_log_perr(cp, "'%s' expands to %s - attribute reference required", value,
+                                                   fr_table_str_by_value(tmpl_type_table, call_env_parsed->tmpl->type,
+                                                                         "<INVALID>"));
+                                       goto error;
+                               }
+                               FALL_THROUGH;
+
+                       case TMPL_TYPE_ATTR:
                                break;
 
                        default: