@@ -567,21 +567,17 @@ static CC_HINT(nonnull(1,2,4)) ssize_t xlat_tokenize_attribute(xlat_exp_head_t *
567567 }
568568
569569 /*
570- * We don't know it's virtual but
571- * we don't know it's not either...
572- *
573- * Mark it up as virtual-unresolved
574- * and let the resolution code figure
575- * this out in a later pass.
570+ * Try to resolve it later
576571 */
577- xlat_exp_set_type (node , XLAT_VIRTUAL_UNRESOLVED );
572+ xlat_exp_set_type (node , XLAT_TMPL );
578573 xlat_exp_set_name_shallow (node , vpt -> name );
579574 node -> vpt = vpt ;
580575 node -> flags .needs_resolving = true;
581- /*
582- * Deal with normal attribute (or list)
583- */
576+
584577 } else {
578+ /*
579+ * Deal with normal attribute (or list)
580+ */
585581 xlat_exp_set_type (node , XLAT_TMPL );
586582 xlat_exp_set_name_shallow (node , vpt -> name );
587583 node -> vpt = vpt ;
@@ -1038,11 +1034,6 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth)
10381034 INFO_INDENT ("virtual (%s)" , node -> fmt );
10391035 break ;
10401036
1041- case XLAT_VIRTUAL_UNRESOLVED :
1042- fr_assert (node -> fmt != NULL );
1043- INFO_INDENT ("virtual-unresolved (%s)" , node -> fmt );
1044- break ;
1045-
10461037 case XLAT_FUNC :
10471038 fr_assert (node -> call .func != NULL );
10481039 INFO_INDENT ("func (%s)" , node -> call .func -> name );
@@ -1288,10 +1279,6 @@ ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_head_t const *head, xlat_exp_t
12881279 FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN (out , node -> call .func -> name );
12891280 break ;
12901281
1291- case XLAT_VIRTUAL_UNRESOLVED :
1292- FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN (out , node -> fmt );
1293- break ;
1294-
12951282 case XLAT_FUNC :
12961283 FR_SBUFF_IN_BSTRCPY_BUFFER_RETURN (out , node -> call .func -> name );
12971284 FR_SBUFF_IN_CHAR_RETURN (out , '(' );
@@ -1927,48 +1914,6 @@ int xlat_resolve(xlat_exp_head_t *head, xlat_res_rules_t const *xr_rules)
19271914 node -> flags .impure_func = !node -> call .func -> flags .pure ;
19281915 break ;
19291916
1930- /*
1931- * This covers unresolved attributes as well as
1932- * unresolved functions.
1933- */
1934- case XLAT_VIRTUAL_UNRESOLVED :
1935- {
1936- if (xlat_resolve_virtual_attribute (node , node -> vpt ) == 0 ) break ;
1937-
1938- /*
1939- * Try and resolve (in-place) as an attribute
1940- */
1941- if ((tmpl_resolve (node -> vpt , xr_rules -> tr_rules ) < 0 ) ||
1942- (node -> vpt -> type != TMPL_TYPE_ATTR )) {
1943- /*
1944- * FIXME - Produce proper error with marker
1945- */
1946- if (!xr_rules -> allow_unresolved ) {
1947- error_unresolved :
1948- if (node -> quote == T_BARE_WORD ) {
1949- fr_strerror_printf_push ("Failed resolving expansion: %s" ,
1950- node -> fmt );
1951- } else {
1952- fr_strerror_printf_push ("Failed resolving expansion: %c%s%c" ,
1953- fr_token_quote [node -> quote ], node -> fmt , fr_token_quote [node -> quote ]);
1954- }
1955- return -1 ;
1956- }
1957- break ;
1958- }
1959-
1960- /*
1961- * Just need to flip the type as the tmpl should already have been fixed up
1962- */
1963- xlat_exp_set_type (node , XLAT_TMPL );
1964-
1965- /*
1966- * Reset node flags. Attributes aren't pure, and don't need further resolving.
1967- */
1968- node -> flags = (xlat_flags_t ){ };
1969- }
1970- break ;
1971-
19721917 case XLAT_TMPL :
19731918 /*
19741919 * Double-quoted etc. strings may contain xlats, so we try to resolve them now.
@@ -1986,7 +1931,15 @@ int xlat_resolve(xlat_exp_head_t *head, xlat_res_rules_t const *xr_rules)
19861931 return -1 ;
19871932 }
19881933
1989- if (node -> flags .needs_resolving && !xr_rules -> allow_unresolved ) goto error_unresolved ;
1934+ if (node -> flags .needs_resolving && !xr_rules -> allow_unresolved ) {
1935+ if (node -> quote == T_BARE_WORD ) {
1936+ fr_strerror_printf_push ("Failed resolving attribute: %s" ,
1937+ node -> fmt );
1938+ } else {
1939+ fr_strerror_printf_push ("Failed resolving attribute: %c%s%c" ,
1940+ fr_token_quote [node -> quote ], node -> fmt , fr_token_quote [node -> quote ]);
1941+ }
1942+ }
19901943
19911944 xlat_flags_merge (& our_flags , & node -> flags );
19921945 }
0 commit comments