]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
assignments which fail don't change the destination
authorAlan T. DeKok <aland@freeradius.org>
Thu, 28 Jul 2022 15:11:56 +0000 (11:11 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 Jul 2022 01:58:17 +0000 (21:58 -0400)
and don't eat the Module-Failure-Message

src/lib/unlang/edit.c
src/tests/keywords/date
src/tests/keywords/ethernet

index 5802bcb5313ba99fe47d575428f533de29deff7c..2fa041c594f78c322b10c449ab181f8d5e4c942b 100644 (file)
@@ -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;
        }
 
index 7efbb0f3cc27c4b0efaf75503d49c9994e3bf761..9a54108c4163da42cb53f7d5104787a48aa31cd1 100644 (file)
@@ -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
 }
 
index 788a150b785ad7e6e92f84203955fff1df2cca95..3585db11007211e8d0f33fbadccdd0063cf6973e 100644 (file)
@@ -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
 }