From: Alan T. DeKok Date: Thu, 8 May 2025 01:45:18 +0000 (-0400) Subject: xlats can't be constant, either X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cec867fe50c2cf02c2f639c8217ab8eebb2b45f;p=thirdparty%2Ffreeradius-server.git xlats can't be constant, either --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 9e52ac0f7c4..fd5fdac594f 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -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;