From: Alan T. DeKok Date: Fri, 20 May 2022 13:42:23 +0000 (-0400) Subject: try to resolve tmpls, and give better errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe119d1f580e105b1d52fc95de9539bffb0fba7;p=thirdparty%2Ffreeradius-server.git try to resolve tmpls, and give better errors --- diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 88b51d84a50..04b47dc12ec 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -1761,8 +1761,13 @@ int xlat_resolve(xlat_exp_head_t *head, xlat_res_rules_t const *xr_rules) */ if (!xr_rules->allow_unresolved) { error_unresolved: - fr_strerror_printf_push("Failed resolving attribute in expansion %%{%s}", - node->fmt); + if (node->quote == T_BARE_WORD) { + fr_strerror_printf_push("Failed resolving attribute in expansion: %s", + node->fmt); + } else { + fr_strerror_printf_push("Failed resolving attribute in expansion: %c%s%c", + fr_token_quote[node->quote], node->fmt, fr_token_quote[node->quote]); + } return -1; } our_flags.needs_resolving = true; /* Still unresolved nodes */ @@ -1783,6 +1788,16 @@ int xlat_resolve(xlat_exp_head_t *head, xlat_res_rules_t const *xr_rules) break; case XLAT_TMPL: + /* + * Double-quoted etc. strings may contain xlats, so we try to resolve them now. + * Or, convert them to data. + */ + if (node->quote != T_BARE_WORD) { + if (tmpl_resolve(node->vpt, xr_rules->tr_rules) < 0) return -1; + + break; + } + if (!xr_rules->allow_unresolved) goto error_unresolved; break;