From: Alan T. DeKok Date: Sun, 29 Aug 2021 12:30:58 +0000 (-0400) Subject: don't allow: Foo = &Client-Shortname X-Git-Tag: release_3_0_24~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c868d841e5db092c43150a03c229cc0ab01adcfd;p=thirdparty%2Ffreeradius-server.git don't allow: Foo = &Client-Shortname it won't work, because the attribut doesn't exist, it's virtual. It has to be "%{Client-Shortname}" --- diff --git a/src/main/map.c b/src/main/map.c index 97a68da5fc5..17988d27f9d 100644 --- a/src/main/map.c +++ b/src/main/map.c @@ -297,14 +297,20 @@ int map_afrom_cp(TALLOC_CTX *ctx, vp_map_t **out, CONF_PAIR *cp, goto error; } - /* - * We cannot assign a count to an attribute. That must - * be done in an xlat. - */ - if ((map->rhs->type == TMPL_TYPE_ATTR) && - (map->rhs->tmpl_num == NUM_COUNT)) { - cf_log_err_cp(cp, "Cannot assign from a count"); - goto error; + if (map->rhs->type == TMPL_TYPE_ATTR) { + /* + * We cannot assign a count to an attribute. That must + * be done in an xlat. + */ + if (map->rhs->tmpl_num == NUM_COUNT) { + cf_log_err_cp(cp, "Cannot assign from a count"); + goto error; + } + + if (map->rhs->tmpl_da->flags.virtual) { + cf_log_err_cp(cp, "Virtual attributes must be in an expansion such as \"%%{%s}\".", map->rhs->tmpl_da->name); + goto error; + } } VERIFY_MAP(map);