From: Alan T. DeKok Date: Sun, 1 Oct 2023 14:43:30 +0000 (-0400) Subject: minor fixes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c62e251114c932cd4ced170c8155482b91e3ca7c;p=thirdparty%2Ffreeradius-server.git minor fixes if we have a cast, then we don't have an enumv, and we can't parse the data as being an enum name. if we have a subexpression, (...), then we don't do math on enum names, so remove the enum there, too. Pass the resulting rules recursively to the parser --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 63dabfef499..0eb4012dcb9 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -2156,7 +2156,10 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf * We may end up removing the cast later, if for example the tmpl is an attribute whose data type * matches the cast. */ - if (cast_type != FR_TYPE_NULL) our_t_rules.cast = cast_type; + if (cast_type != FR_TYPE_NULL) { + our_t_rules.cast = cast_type; + our_t_rules.enumv = NULL; + } /* * If we still have '(', then recurse for other expressions @@ -2169,11 +2172,14 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf * value when we get the output of the expression. */ if (fr_sbuff_next_if_char(&our_in, '(')) { + our_t_rules.cast = FR_TYPE_NULL; + our_t_rules.enumv = NULL; + /* * No input rules means "ignore external terminal sequences, as we're expecting a ')' as * our terminal sequence. */ - if (tokenize_expression(head, &node, &our_in, bracket_rules, t_rules, T_INVALID, bracket_rules, NULL, cond) < 0) { + if (tokenize_expression(head, &node, &our_in, bracket_rules, &our_t_rules, T_INVALID, bracket_rules, NULL, cond) < 0) { FR_SBUFF_ERROR_RETURN(&our_in); }