]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use comparison operators for RHS list of &request -= { ... }
authorAlan T. DeKok <aland@freeradius.org>
Sun, 31 Jul 2022 01:17:36 +0000 (21:17 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 31 Jul 2022 01:23:11 +0000 (21:23 -0400)
src/lib/unlang/edit.c
src/lib/util/edit.c
src/tests/keywords/edit-list-remove

index a10734d2726ed59926376c7f2e20bcf8e97d857e..0e929d5809777a37b35cdc3ddd2c2f4fed1d0bd8 100644 (file)
@@ -780,7 +780,7 @@ redo:
                                 *      Child attributes are created in a temporary list.  Any list editing is
                                 *      taken care of by the parent map.
                                 */
-                               fr_assert(map->op == T_OP_EQ);
+                               fr_assert((map->op == T_OP_EQ) || (current->parent->map->op == T_OP_SUB_EQ));
 
                                /*
                                 *      We create this VP in the "current" context, so that it's freed on
@@ -792,6 +792,7 @@ redo:
                                 */
                                MEM(current->lhs.vp = fr_pair_afrom_da(current, tmpl_da(current->lhs.vpt)));
                                fr_pair_append(&current->parent->rhs.pair_list, current->lhs.vp);
+                               current->lhs.vp->op = map->op;
                                current->in_parent_list = true;
 
                        } else if (tmpl_find_vp(&current->lhs.vp, request, current->lhs.vpt) < 0) {
index 9d9788ffdbebbe518db1de8e261dcd18b437d958..1d1dd02200ca89441d134095e46f1ad739d482ea 100644 (file)
@@ -817,8 +817,10 @@ static int fr_edit_list_delete_list(fr_edit_list_t *el, fr_pair_list_t *list, fr
                     found = fr_pair_find_by_da(list, found, vp->da)) {
                        int rcode;
 
-                       rcode = fr_value_box_cmp(&vp->data, &found->data);
-                       if (rcode != 0) continue;
+                       rcode = fr_value_box_cmp_op(vp->op, &vp->data, &found->data);
+                       if (rcode < 0) return -1;
+
+                       if (!rcode) continue;
 
                        if (fr_edit_list_pair_delete(el, list, found) < 0) return -1;
                        break;                      
index a90140b72ffb76b9d1cc1639a3e20056267ef9b0..db29caed26a9eac720c96320a0211cd825681fe2 100644 (file)
@@ -75,7 +75,7 @@ if (&request.Tmp-String-0) {
 #  as a condition?  For now, it's an exact match. :(
 #
 &request -= {
-       &Tmp-String-0 = "bar"
+       &Tmp-String-0 == "bar"
 }
 
 if (&Tmp-String-0[0] != "foo") {