From: Alan T. DeKok Date: Sat, 23 Dec 2023 19:48:55 +0000 (-0500) Subject: is RHS of struct assignment is xlat, cast it to a string X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=549eb927e44aeba134d0055f7a6302e016e17ad8;p=thirdparty%2Ffreeradius-server.git is RHS of struct assignment is xlat, cast it to a string so that radius_legacy_map_apply() doesn't have to do much else --- diff --git a/src/lib/server/map.c b/src/lib/server/map.c index a7da438b5e3..dd3714fe10e 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -747,6 +747,13 @@ check_for_child: if (parent_p) *parent_p = parent; + /* + * Xlat expansions are cast to strings for structural data types. + */ + if (tmpl_attr_tail_da_is_structural(map->lhs) && (tmpl_is_xlat(map->rhs))) { + tmpl_cast_set(map->rhs, FR_TYPE_STRING); + } + MAP_VERIFY(map); *out = map; @@ -2643,6 +2650,13 @@ int map_afrom_fields(TALLOC_CTX *ctx, map_t **out, map_t **parent_p, request_t * slen = tmpl_afrom_substr(map, &map->rhs, &FR_SBUFF_IN(rhs, strlen(rhs)), T_BARE_WORD, value_parse_rules_unquoted[T_BARE_WORD], &my_rules); if (slen <= 0) goto error; + + /* + * Xlat expansions are cast to strings for structural data types. + */ + if (tmpl_attr_tail_da_is_structural(map->lhs) && (tmpl_is_xlat(map->rhs))) { + tmpl_cast_set(map->rhs, FR_TYPE_STRING); + } } if (tmpl_needs_resolving(map->rhs)) {