From: Nick Porter Date: Thu, 24 Aug 2023 18:54:07 +0000 (+0100) Subject: Always use expanded "if" condition X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f06ed05740a5ab92b2c49f4cb4372f2dad7281b9;p=thirdparty%2Ffreeradius-server.git Always use expanded "if" condition Makes debug output correct when variables are referenced in conditions. --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 07e282dedd5..29d355064c1 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -1389,7 +1389,7 @@ static ssize_t fr_skip_condition(char const *start, char const *end, bool const was_regex = false; continue; } - + if (*p == ')') { if (!depth) { fr_strerror_const("Too many ')'"); @@ -1410,7 +1410,7 @@ static ssize_t fr_skip_condition(char const *start, char const *end, bool const fr_strerror_const("Expansions cannot extend across end of line"); return -(p - start); } - + if ((p[1] == '{') || ((p[0] == '$') && (p[1] == '('))) { slen = fr_skip_xlat(p, end); @@ -1631,7 +1631,6 @@ static CONF_ITEM *process_if(cf_stack_t *stack) */ memcpy(buff[2], stack->ptr, slen); buff[2][slen] = '\0'; - name2 = buff[2]; while (slen > 0) { if (!isspace((uint8_t) buff[2][slen])) break; @@ -1657,6 +1656,8 @@ static CONF_ITEM *process_if(cf_stack_t *stack) return NULL; } + name2 = buff[3]; + if (!use_new_conditions) { my_slen = fr_cond_tokenize(cs, &cond, &t_rules, &FR_SBUFF_IN(buff[3], strlen(buff[3])), false); if (my_slen <= 0) { @@ -1677,8 +1678,6 @@ static CONF_ITEM *process_if(cf_stack_t *stack) talloc_free(cs); return NULL; } - } else { - name2 = buff[3]; } }