]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow '=' for list assignment to leaf types, too
authorAlan T. DeKok <aland@freeradius.org>
Tue, 15 Aug 2023 20:07:25 +0000 (16:07 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 15 Aug 2023 20:07:25 +0000 (16:07 -0400)
src/lib/unlang/edit.c
src/tests/keywords/edit-list-eq [new file with mode: 0644]

index 35e693c5930cdd498e95cb324413b40b5eee0fe6..eb687adc3bfae200981fca3d9d90eb28cf53f534 100644 (file)
@@ -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 (file)
index 0000000..ab647f4
--- /dev/null
@@ -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