From: Alan T. DeKok Date: Mon, 21 Aug 2023 21:19:58 +0000 (-0400) Subject: hoist checks to be more consistent X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2cf12d095705d885e75067293a5f1a217d9d37c;p=thirdparty%2Ffreeradius-server.git hoist checks to be more consistent --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index e24c26cd0dd..7aee07d0d43 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -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.