From: Alan T. DeKok Date: Wed, 19 Aug 2015 10:28:50 +0000 (-0400) Subject: Disallow assigning [#]. Fixes #1171 X-Git-Tag: release_3_0_10~217 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a099f3e9bd2bd2291512dc3171f917a87833d0a;p=thirdparty%2Ffreeradius-server.git Disallow assigning [#]. Fixes #1171 --- diff --git a/src/main/map.c b/src/main/map.c index e2f142f865b..88d89c19130 100644 --- a/src/main/map.c +++ b/src/main/map.c @@ -285,6 +285,16 @@ 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; + } + VERIFY_MAP(map); *out = map; diff --git a/src/tests/map/count-error b/src/tests/map/count-error new file mode 100644 index 00000000000..925360d761a --- /dev/null +++ b/src/tests/map/count-error @@ -0,0 +1,6 @@ +# +# This should be an xlat, not a direct assignment +# +update request { + Tmp-Integer-0 := &Filter-Id[#] # ERROR +} \ No newline at end of file diff --git a/src/tests/map/count-list-error b/src/tests/map/count-list-error new file mode 100644 index 00000000000..a7beae138a3 --- /dev/null +++ b/src/tests/map/count-list-error @@ -0,0 +1,6 @@ +# +# Updating lists isn't allowed +# +update { + &request:Filter-Id := &Filter-Id[#] # ERROR +}