From: Alan T. DeKok Date: Tue, 9 Aug 2022 16:35:23 +0000 (-0400) Subject: allow &request -= "Tmp-String-0 == 'foo'" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c526550d11c003e65b0039736eef3cd369c26bb3;p=thirdparty%2Ffreeradius-server.git allow &request -= "Tmp-String-0 == 'foo'" for getting rid of pairs via things like SQL queries --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 42c33d95d1e..b0fad445dee 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -313,14 +313,6 @@ static int apply_edits_to_list(request_t *request, edit_map_t *current, map_t co rhs_box = tmpl_value(current->rhs.vpt); - /* - * @todo - just parse the data as a string, and remove it? - */ - if (map->op == T_OP_SUB_EQ) { - REDEBUG("%s[%d] Cannot remove data from a list", MAP_INFO); - return -1; - } - da = current->lhs.vp->da; if (fr_type_is_group(da->type)) da = fr_dict_root(request->dict); diff --git a/src/tests/keywords/edit-list-remove b/src/tests/keywords/edit-list-remove index db29caed26a..d7b57b0e2d8 100644 --- a/src/tests/keywords/edit-list-remove +++ b/src/tests/keywords/edit-list-remove @@ -90,6 +90,16 @@ if (&Tmp-String-0[2]) { test_fail } -%(debug_attr:request[*]) +# +# Remove via in-place list, too. +# +&request -= "Tmp-String-0 == 'foo'" +if (&Tmp-String-0[0] != "baz") { + test_fail +} + +if (&Tmp-String-0[1]) { + test_fail +} success