]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
xlats can't be constant, either
authorAlan T. DeKok <aland@freeradius.org>
Thu, 8 May 2025 01:45:18 +0000 (21:45 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 8 May 2025 01:45:18 +0000 (21:45 -0400)
src/lib/unlang/compile.c

index 9e52ac0f7c4a945adc26230fe1812b28a724cece..fd5fdac594fb5e8ce3b45a0015099b7fe9c7432b 100644 (file)
@@ -2707,6 +2707,16 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
                goto error;
        }
 
+       if (tmpl_is_xlat(gext->vpt)) {
+               xlat_exp_head_t *xlat = tmpl_xlat(gext->vpt);
+
+               if (xlat->flags.constant || xlat->flags.pure) {
+                       cf_log_err(cs, "Cannot use constant data for 'switch' statement");
+                       goto error;
+               }
+       }
+
+
        if (tmpl_needs_resolving(gext->vpt)) {
                cf_log_err(cs, "Cannot resolve key for 'switch' statement");
                goto error;