From: Arran Cudbard-Bell Date: Wed, 20 Jan 2021 12:05:59 +0000 (+0000) Subject: At least _try_ to resolve unresolved attributes in xlats X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db9dd99009666a3df032964c3f2d00b0e44bc296;p=thirdparty%2Ffreeradius-server.git At least _try_ to resolve unresolved attributes in xlats --- diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 4267c8c01f9..97e994a85bd 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -1616,8 +1616,9 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, bool allow_unresolved) } break; /* - * This covers unresolved attributes as well as - * unresolved functions. + * Virtual unresolved attributes get + * resolved to functions, and failing + * that to a dictionary attribute. */ case XLAT_VIRTUAL_UNRESOLVED: { @@ -1643,16 +1644,20 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, bool allow_unresolved) node->flags = (xlat_flags_t){ .needs_async = func->needs_async }; break; } + FALL_THROUGH; + /* + * An unresolved attribute + */ + case XLAT_ATTRIBUTE: /* * Try and resolve (in-place) as an attribute */ - if ((tmpl_resolve(node->attr) < 0) || (node->attr->type != TMPL_TYPE_ATTR)) { + if ((tmpl_resolve(node->attr) < 0) || (!tmpl_is_attr(node->attr))) { /* * FIXME - Produce proper error with marker */ if (!allow_unresolved) { - error_unresolved: fr_strerror_printf_push("Failed resolving attribute in expansion %%{%s}", node->fmt); return -1; @@ -1674,10 +1679,6 @@ int xlat_resolve(xlat_exp_t **head, xlat_flags_t *flags, bool allow_unresolved) } break; - case XLAT_ATTRIBUTE: - if (!allow_unresolved) goto error_unresolved; - break; - default: fr_assert(0); /* Should not have been marked as unresolved */ return -1;