From: Alan T. DeKok Date: Tue, 15 Aug 2023 20:07:25 +0000 (-0400) Subject: allow '=' for list assignment to leaf types, too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2895adcd9d8aec4b265dd37462170fd6716ab5e6;p=thirdparty%2Ffreeradius-server.git allow '=' for list assignment to leaf types, too --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 35e693c5930..eb687adc3bf 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -962,7 +962,7 @@ static int expand_rhs_list(request_t *request, unlang_frame_state_edit_t *state, * @todo - when we support value-box groups on the RHS in * apply_edits_to_leaf(), this next block can be deleted. */ - if (fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type) && (map->op != T_OP_SET)) { + if (fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type) && (map->op != T_OP_SET) && (map->op != T_OP_EQ)) { REDEBUG("%s[%d] Must use ':=' when editing list of normal data types", MAP_INFO); return -1; } diff --git a/src/tests/keywords/edit-list-eq b/src/tests/keywords/edit-list-eq new file mode 100644 index 00000000000..ab647f4c8e1 --- /dev/null +++ b/src/tests/keywords/edit-list-eq @@ -0,0 +1,31 @@ +# +# PRE: if edit-list +# +&control.Filter-Id = { 'A', 'B' } + +if !(%{control.Filter-Id[#]} == 2) { + test_fail +} + +if !(&control.Filter-Id[1] == 'B') { + test_fail +} + +# +# Add of SECOND bit fails +# +&control.Filter-Id = { 'C', 'D' } + +if !(%{control.Filter-Id[#]} == 2) { + test_fail +} + +if !(&control.Filter-Id[0] == 'A') { + test_fail +} + +if !(&control.Filter-Id[1] == 'B') { + test_fail +} + +success