]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hoist checks to be more consistent
authorAlan T. DeKok <aland@freeradius.org>
Mon, 21 Aug 2023 21:19:58 +0000 (17:19 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 21 Aug 2023 21:19:58 +0000 (17:19 -0400)
src/lib/unlang/edit.c

index e24c26cd0dd6a5dd3f336ba41d488d979fd2d32b..7aee07d0d431d62fc5abd8e60bd8b1844530689c 100644 (file)
@@ -582,9 +582,17 @@ static int apply_edits_to_leaf(request_t *request, unlang_frame_state_edit_t *st
                pair = true;
        }
 
-       if (!box && (map->op != T_OP_SET)) {
-               RWDEBUG("%s %s ... - Assignment failed - No value on right-hand side", map->lhs->name, fr_tokens[map->op]);
-               return -1;
+       if (!box) {
+               if (map->op != T_OP_SET) {
+                       RWDEBUG("%s %s ... - Assignment failed - No value on right-hand side", map->lhs->name, fr_tokens[map->op]);
+                       return -1;
+               }
+
+               /*
+                *      Set is "delete, then add".
+                */
+               RDEBUG2("%s :=", current->lhs.vpt->name);
+               goto done;
        }
 
        /*
@@ -630,11 +638,6 @@ static int apply_edits_to_leaf(request_t *request, unlang_frame_state_edit_t *st
                fr_dict_attr_t const *da = tmpl_attr_tail_da(current->lhs.vpt);
                fr_pair_t *vp;
 
-               if (!box) {
-                       RDEBUG2("%s %s ...", current->lhs.vpt->name, fr_tokens[map->op]);
-                       goto done;
-               }
-
                /*
                 *      Something went wrong creating the value, it's a failure.  Note that we fail _all_
                 *      subsequent assignments, too.