From: Alan T. DeKok Date: Thu, 28 Jul 2022 15:11:56 +0000 (-0400) Subject: assignments which fail don't change the destination X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4368b5f3791e7299ac0d201a7b18b143d243dd93;p=thirdparty%2Ffreeradius-server.git assignments which fail don't change the destination and don't eat the Module-Failure-Message --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 5802bcb5313..2fa041c594f 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -133,7 +133,7 @@ static int templatize_rhs(TALLOC_CTX *ctx, edit_result_t *out, fr_pair_t const * fr_value_box_t *box = fr_dlist_head(&out->result); if (!box) { - RPEDEBUG("No value found for assignment"); + RWDEBUG("No value found for assignment"); return -1; } diff --git a/src/tests/keywords/date b/src/tests/keywords/date index 7efbb0f3cc2..9a54108c416 100644 --- a/src/tests/keywords/date +++ b/src/tests/keywords/date @@ -47,9 +47,10 @@ if (&Tmp-String-2 != '2022-08-08 19:04:19') { # Invalid format &Tmp-String-3 := '201-32-22 17:25:00' -&Tmp-String-0 := "%(sqldate:%{Tmp-String-3})" +&Tmp-String-4 := "%(sqldate:%{Tmp-String-3})" -if (&Tmp-String-0 != "") { +# This shouldn't exist, as the RHS above is NULL, and therefore the assignment will fail +if (&Tmp-String-4) { test_fail } @@ -59,9 +60,9 @@ if (&Module-Failure-Message != "Failed to parse time string \"201-32-22 17:25:00 # Invalid type &NAS-IP-Address := "192.168.1.1" -&Tmp-String-4 := %(date:%{NAS-IP-Address}) +&Tmp-String-5 := %(date:%{NAS-IP-Address}) -if (&Tmp-String-4 != "") { +if (&Tmp-String-5) { test_fail } diff --git a/src/tests/keywords/ethernet b/src/tests/keywords/ethernet index 788a150b785..3585db11007 100644 --- a/src/tests/keywords/ethernet +++ b/src/tests/keywords/ethernet @@ -21,14 +21,11 @@ if (&Tmp-Ethernet-0[2] != 00:11:22:33:44:56) { } # invalid assignment +# this will silently fail with a no Module-Failure-Message. &request += { &Tmp-Ethernet-0 = %{Tmp-Ethernet-1[42]} } -if (&request.Module-Failure-Message != "No value found for assignment") { - test_fail -} - if (%{request.Tmp-Ethernet-0[#]} != 3) { test_fail }