From: Jorge Pereira Date: Mon, 3 Oct 2022 13:04:32 +0000 (+0200) Subject: More "update {....}" to edit against src/tests/modules/* (#4735) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=049f3d7c3e6c49d7b3577c7fd393107ac69d3d08;p=thirdparty%2Ffreeradius-server.git More "update {....}" to edit against src/tests/modules/* (#4735) --- diff --git a/src/tests/modules/always/set_rcode.unlang b/src/tests/modules/always/set_rcode.unlang index 8c5818dc993..977157727d9 100644 --- a/src/tests/modules/always/set_rcode.unlang +++ b/src/tests/modules/always/set_rcode.unlang @@ -2,19 +2,18 @@ # Set status to "notfound". xlat should expand to previous status, "alive" # if ("%(db_status:notfound)" != "alive") { - update reply { - &Reply-Message += "failed" + &reply += { + &Reply-Message = "Failure in test at line %(interpreter:...line)" } } - # # Verify that the status was changed # db_status if (!notfound) { - update reply { - &Reply-Message += "failed" + &reply += { + &Reply-Message = "Failure in test at line %(interpreter:...line)" } } @@ -23,8 +22,8 @@ if (!notfound) { # Fetch status using xlat without setting the status # if ("%(db_status:)" != "notfound") { - update reply { - &Reply-Message += "failed" + &reply += { + &Reply-Message = "Failure in test at line %(interpreter:...line)" } } @@ -34,11 +33,9 @@ if ("%(db_status:)" != "notfound") { # db_status if (notfound) { - update reply { - &Reply-Message += "success" + &reply += { + &Reply-Message = "success" } } -update control { - &Password.Cleartext := "hello" -} +&control.Password.Cleartext := "hello" diff --git a/src/tests/modules/always/set_status_dead.unlang b/src/tests/modules/always/set_status_dead.unlang index 6f70e503561..99dbd5f450d 100644 --- a/src/tests/modules/always/set_status_dead.unlang +++ b/src/tests/modules/always/set_status_dead.unlang @@ -8,11 +8,7 @@ db_status { } if (fail) { - update reply { - &Reply-Message := "success" - } + &reply.Reply-Message := "success" } -update control { - &Password.Cleartext := "hello" -} +&control.Password.Cleartext := "hello" diff --git a/src/tests/modules/always/set_status_revive.unlang b/src/tests/modules/always/set_status_revive.unlang index 1d19542ebf4..03af845236f 100644 --- a/src/tests/modules/always/set_status_revive.unlang +++ b/src/tests/modules/always/set_status_revive.unlang @@ -6,8 +6,8 @@ db_status { fail = 1 } if (!fail) { - update reply { - &Reply-Message += "failed" + &reply += { + &Reply-Message = "Failure in test at line %(interpreter:...line)" } } @@ -18,11 +18,9 @@ if (!fail) { %(db_status:alive) db_status if (ok) { - update reply { - &Reply-Message += "success" + &reply += { + &Reply-Message = "success" } } -update control { - &Password.Cleartext := "hello" -} +&control.Password.Cleartext := "hello" diff --git a/src/tests/modules/attr_filter/bob.unlang b/src/tests/modules/attr_filter/bob.unlang index c092c8d2af9..f4c4728caf8 100644 --- a/src/tests/modules/attr_filter/bob.unlang +++ b/src/tests/modules/attr_filter/bob.unlang @@ -1,9 +1,7 @@ attr_filter -update control { - &Password.Cleartext := "goodbye" -} +&control.Password.Cleartext := "goodbye" -update reply { - &Reply-Message := "success" +&reply += { + &Reply-Message = "success" } diff --git a/src/tests/modules/attr_filter/operators.unlang b/src/tests/modules/attr_filter/operators.unlang index cd636c0093d..80176ca5334 100644 --- a/src/tests/modules/attr_filter/operators.unlang +++ b/src/tests/modules/attr_filter/operators.unlang @@ -24,10 +24,5 @@ if ((&Calling-Station-Id != "bob") || (&Calling-Station-Id[1] != "jim") || (&Cal test_fail } -update control { - &Password.Cleartext := "goodbye" -} - -update reply { - &Reply-Message := &request.Reply-Message -} +&control.Password.Cleartext := "goodbye" +&reply.Reply-Message := &Reply-Message diff --git a/src/tests/modules/cache_rbtree/cache-bin.unlang b/src/tests/modules/cache_rbtree/cache-bin.unlang index 1d7a64fa833..889531f07ac 100644 --- a/src/tests/modules/cache_rbtree/cache-bin.unlang +++ b/src/tests/modules/cache_rbtree/cache-bin.unlang @@ -6,10 +6,8 @@ # Series of tests to check for binary safe operation of the cache module # both keys and values should be binary safe. # -update { - &Tmp-Octets-0 := 0xaa00bb00cc00dd00 - &Tmp-String-1 := "foo\000bar\000baz" -} +&Tmp-Octets-0 := 0xaa00bb00cc00dd00 +&Tmp-String-1 := "foo\000bar\000baz" # 0. Sanity check if (&Tmp-String-1 != "foo\000bar\000baz") { @@ -23,10 +21,8 @@ if (!updated) { } # Now add a second entry, with the value diverging after the first null byte -update { - &Tmp-Octets-0 := 0xaa00bb00cc00ee00 - &Tmp-String-1 := "bar\000baz" -} +&Tmp-Octets-0 := 0xaa00bb00cc00ee00 +&Tmp-String-1 := "bar\000baz" # 2. Should create a *new* entry and not update the existing one cache_bin_key_octets.store @@ -34,15 +30,11 @@ if (!updated) { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # If the key is binary safe, we should now be able to retrieve the first entry # if it's not, the above test will likely fail, or we'll get the second entry. -update { - &Tmp-Octets-0 := 0xaa00bb00cc00dd00 -} +&Tmp-Octets-0 := 0xaa00bb00cc00dd00 cache_bin_key_octets if (!updated) { @@ -57,14 +49,10 @@ if (&Tmp-String-1 != "foo\000bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now try and get the second entry -update { - &Tmp-Octets-0 := 0xaa00bb00cc00ee00 -} +&Tmp-Octets-0 := 0xaa00bb00cc00ee00 cache_bin_key_octets if (!updated) { @@ -79,45 +67,33 @@ if (&Tmp-String-1 != "bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} - +&request -= &Tmp-String-1[*] # # We should also be able to use any fixed length data type as a key # though there are no guarantees this will be portable. # -update { - &Tmp-IP-Address-0 := 192.168.0.1 - &Tmp-String-1 := "foo\000bar\000baz" -} +&Tmp-IP-Address-0 := 192.168.0.1 +&Tmp-String-1 := "foo\000bar\000baz" cache_bin_key_ipaddr if (!ok) { test_fail } - # Now add a second entry -update { - &Tmp-IP-Address-0:= 192.168.0.2 - &Tmp-String-1 := "bar\000baz" -} +&Tmp-IP-Address-0:= 192.168.0.2 +&Tmp-String-1 := "bar\000baz" cache_bin_key_ipaddr if (!ok) { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now retrieve the first entry -update { - &Tmp-IP-Address-0 := 192.168.0.1 -} +&Tmp-IP-Address-0 := 192.168.0.1 cache_bin_key_ipaddr if (!updated) { @@ -132,14 +108,10 @@ if (&Tmp-String-1 != "foo\000bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now try and get the second entry -update { - &Tmp-IP-Address-0 := 192.168.0.2 -} +&Tmp-IP-Address-0 := 192.168.0.2 cache_bin_key_ipaddr if (!updated) { @@ -154,8 +126,6 @@ if (&Tmp-String-1 != "bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] test_pass diff --git a/src/tests/modules/cache_rbtree/cache-logic.unlang b/src/tests/modules/cache_rbtree/cache-logic.unlang index 49aa41724c0..25a6f6b0e47 100644 --- a/src/tests/modules/cache_rbtree/cache-logic.unlang +++ b/src/tests/modules/cache_rbtree/cache-logic.unlang @@ -1,17 +1,12 @@ # # PRE: # -update { - &request.Tmp-String-0 := 'testkey' -} - +&Tmp-String-0 := 'testkey' # # 0. Basic store and retrieve # -update control { - &control.Tmp-String-1 := 'cache me' -} +&control.Tmp-String-1 := 'cache me' cache if (!ok) { @@ -19,14 +14,13 @@ if (!ok) { } # 1. Check the module didn't perform a merge -if (&request.Tmp-String-1) { +if (&Tmp-String-1) { test_fail } # 2. Check status-only works correctly (should return ok and consume attribute) -update control { - &Cache-Status-Only := 'yes' -} +&control.Cache-Status-Only := 'yes' + cache if (!ok) { test_fail @@ -44,14 +38,12 @@ if (!updated) { } # 5. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 6. Retrieving the entry should not expire it -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] cache if (!updated) { @@ -59,7 +51,7 @@ if (!updated) { } # 7. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } else { @@ -67,20 +59,18 @@ else { } # 8. Force expiry of the entry -update control { - &Cache-Allow-Merge := no - &Cache-Allow-Insert := no - &Cache-TTL := 0 -} +&control.Cache-Allow-Merge := no +&control.Cache-Allow-Insert := no +&control.Cache-TTL := 0 + cache if (!ok) { test_fail } # 9. Check status-only works correctly (should return notfound and consume attribute) -update control { - &Cache-Status-Only := 'yes' -} +&control.Cache-Status-Only := 'yes' + cache if (!notfound) { test_fail @@ -92,10 +82,9 @@ if (&control.Cache-Status-Only) { } # 11. Check merge-only works correctly (should return notfound and consume attribute) -update control { - &Cache-Allow-Merge := 'yes' - &Cache-Allow-Insert := 'no' -} +&control.Cache-Allow-Merge := 'yes' +&control.Cache-Allow-Insert := 'no' + cache if (!notfound) { test_fail @@ -107,18 +96,16 @@ if (&control.Cache-Allow-Merge) { } # 13. ...and check the entry wasn't recreated -update control { - &Cache-Status-Only := 'yes' -} +&control.Cache-Status-Only := 'yes' + cache if (!notfound) { test_fail } # 14. This should still allow the creation of a new entry -update control { - &Cache-TTL := -1 -} +&control.Cache-TTL := -1 + cache if (!ok) { test_fail @@ -131,44 +118,40 @@ if (!updated) { } # 16. -if (&Cache-TTL) { +if (&control.Cache-TTL) { test_fail } # 17. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } -update control { - &Tmp-String-1 := 'cache me2' -} +&control.Tmp-String-1 := 'cache me2' # 18. Updating the Cache-TTL shouldn't make things go boom (we can't really check if it works) -update control { - &Cache-TTL := 30 -} +&control.Cache-TTL := 30 + cache if (!updated) { test_fail } # 19. Request Tmp-String-1 shouldn't have been updated yet -if (&request.Tmp-String-1 == &control.Tmp-String-1) { +if (&Tmp-String-1 == &control.Tmp-String-1) { test_fail } # 20. Check that a new entry is created -update control { - &Cache-TTL := -1 -} +&control.Cache-TTL := -1 + cache if (!updated) { test_fail } # 21. Request Tmp-String-1 still shouldn't have been updated yet -if (&request.Tmp-String-1 == &control.Tmp-String-1) { +if (&Tmp-String-1 == &control.Tmp-String-1) { test_fail } @@ -179,33 +162,32 @@ if (!updated) { } # 23. Request Tmp-String-1 should now have been updated -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 24. Check Cache-Merge = yes works as expected (should update current request) -update control { - &Tmp-String-1 := 'cache me3' - &Cache-TTL := -1 - &Cache-Merge-New := yes -} +&control.Tmp-String-1 := 'cache me3' +&control.Cache-TTL := -1 +&control.Cache-Merge-New := yes + cache if (!updated) { test_fail } # 25. Request Tmp-String-1 should now have been updated -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 26. Check Cache-Entry-Hits is updated as we expect -if (&request.Cache-Entry-Hits != 0) { +if (&Cache-Entry-Hits != 0) { test_fail } cache -if (&request.Cache-Entry-Hits != 1) { +if (&Cache-Entry-Hits != 1) { test_fail } diff --git a/src/tests/modules/cache_rbtree/cache-method-bin.unlang b/src/tests/modules/cache_rbtree/cache-method-bin.unlang index 3ffc913ee66..56e0600c4dd 100644 --- a/src/tests/modules/cache_rbtree/cache-method-bin.unlang +++ b/src/tests/modules/cache_rbtree/cache-method-bin.unlang @@ -6,10 +6,8 @@ # Series of tests to check for binary safe operation of the cache module # both keys and values should be binary safe. # -update { - &Tmp-Octets-0 := 0xaa00bb00cc00dd00 - &Tmp-String-1 := "foo\000bar\000baz" -} +&Tmp-Octets-0 := 0xaa00bb00cc00dd00 +&Tmp-String-1 := "foo\000bar\000baz" # 0. Sanity check if (&Tmp-String-1 != "foo\000bar\000baz") { @@ -23,10 +21,8 @@ if (!updated) { } # Now add a second entry, with the value diverging after the first null byte -update { - &Tmp-Octets-0 := 0xaa00bb00cc00ee00 - &Tmp-String-1 := "bar\000baz" -} +&Tmp-Octets-0 := 0xaa00bb00cc00ee00 +&Tmp-String-1 := "bar\000baz" # 2. Should create a *new* entry and not update the existing one cache_bin_key_octets.store @@ -34,15 +30,11 @@ if (!updated) { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # If the key is binary safe, we should now be able to retrieve the first entry # if it's not, the above test will likely fail, or we'll get the second entry. -update { - &Tmp-Octets-0 := 0xaa00bb00cc00dd00 -} +&Tmp-Octets-0 := 0xaa00bb00cc00dd00 cache_bin_key_octets.load if (!updated) { @@ -57,14 +49,10 @@ if (&Tmp-String-1 != "foo\000bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now try and get the second entry -update { - &Tmp-Octets-0 := 0xaa00bb00cc00ee00 -} +&Tmp-Octets-0 := 0xaa00bb00cc00ee00 cache_bin_key_octets.load if (!updated) { @@ -79,44 +67,33 @@ if (&Tmp-String-1 != "bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # # We should also be able to use any fixed length data type as a key # though there are no guarantees this will be portable. # -update { - &Tmp-IP-Address-0 := 192.168.0.1 - &Tmp-String-1 := "foo\000bar\000baz" -} +&Tmp-IP-Address-0 := 192.168.0.1 +&Tmp-String-1 := "foo\000bar\000baz" cache_bin_key_ipaddr.store if (!updated) { test_fail } - # Now add a second entry -update { - &Tmp-IP-Address-0:= 192.168.0.2 - &Tmp-String-1 := "bar\000baz" -} +&Tmp-IP-Address-0:= 192.168.0.2 +&Tmp-String-1 := "bar\000baz" cache_bin_key_ipaddr.store if (!updated) { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now retrieve the first entry -update { - &Tmp-IP-Address-0 := 192.168.0.1 -} +&Tmp-IP-Address-0 := 192.168.0.1 cache_bin_key_ipaddr.load if (!updated) { @@ -131,14 +108,10 @@ if (&Tmp-String-1 != "foo\000bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Now try and get the second entry -update { - &Tmp-IP-Address-0 := 192.168.0.2 -} +&Tmp-IP-Address-0 := 192.168.0.2 cache_bin_key_ipaddr.load if (!updated) { @@ -153,8 +126,6 @@ if (&Tmp-String-1 != "bar\000baz") { test_fail } -update { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] test_pass diff --git a/src/tests/modules/cache_rbtree/cache-method-logic.unlang b/src/tests/modules/cache_rbtree/cache-method-logic.unlang index d95ff75fcee..91e8f9a0491 100644 --- a/src/tests/modules/cache_rbtree/cache-method-logic.unlang +++ b/src/tests/modules/cache_rbtree/cache-method-logic.unlang @@ -1,16 +1,12 @@ # # PRE: # -update { - &request.Tmp-String-0 := 'testkey' -} +&Tmp-String-0 := 'testkey' # # 0. Basic store and retrieve # -update control { - &control.Tmp-String-1 := 'cache me' -} +&control.Tmp-String-1 := 'cache me' cache.store if (!updated) { @@ -18,7 +14,7 @@ if (!updated) { } # 1. Check the module didn't perform a merge -if (&request.Tmp-String-1) { +if (&Tmp-String-1) { test_fail } @@ -35,14 +31,12 @@ if (!updated) { } # 4. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 5. Retrieving the entry should not expire it -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] cache.load if (!updated) { @@ -50,7 +44,7 @@ if (!updated) { } # 6. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } @@ -67,9 +61,8 @@ if (!notfound) { } # 14. This should still allow the creation of a new entry -update control { - &Cache-TTL := -1 -} +&control.Cache-TTL := -1 + cache.store if (!updated) { test_fail @@ -87,39 +80,35 @@ if (&Cache-TTL) { } # 14. -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } -update control { - &Tmp-String-1 := 'cache me2' -} +&control.Tmp-String-1 := 'cache me2' # 18. Updating the Cache-TTL shouldn't make things go boom (we can't really check if it works) -update control { - &Cache-TTL := 666 -} +&control.Cache-TTL := 666 + cache.ttl if (!updated) { test_fail } # 19. Request Tmp-String-1 shouldn't have been updated yet -if (&request.Tmp-String-1 == &control.Tmp-String-1) { +if (&Tmp-String-1 == &control.Tmp-String-1) { test_fail } # 20. Check that a new entry is created -update control { - &Cache-TTL := -1 -} +&control.Cache-TTL := -1 + cache.store if (!updated) { test_fail } # 21. Request Tmp-String-1 still shouldn't have been updated yet -if (&request.Tmp-String-1 == &control.Tmp-String-1) { +if (&Tmp-String-1 == &control.Tmp-String-1) { test_fail } @@ -130,33 +119,32 @@ if (!updated) { } # 23. Request Tmp-String-1 should now have been updated -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 24. Check Cache-Merge = yes works as expected (should update current request) -update control { - &Tmp-String-1 := 'cache me3' - &Cache-TTL := -1 - &Cache-Merge-New := yes -} +&control.Tmp-String-1 := 'cache me3' +&control.Cache-TTL := -1 +&control.Cache-Merge-New := yes + cache.store if (!updated) { test_fail } # 25. Request Tmp-String-1 should now have been updated -if (&request.Tmp-String-1 != &control.Tmp-String-1) { +if (&Tmp-String-1 != &control.Tmp-String-1) { test_fail } # 26. Check Cache-Entry-Hits is updated as we expect -if (&request.Cache-Entry-Hits != 0) { +if (&Cache-Entry-Hits != 0) { test_fail } cache.load -if (&request.Cache-Entry-Hits != 1) { +if (&Cache-Entry-Hits != 1) { test_fail } diff --git a/src/tests/modules/cache_rbtree/cache-method-update.unlang b/src/tests/modules/cache_rbtree/cache-method-update.unlang index 57f8d315502..26c4731178d 100644 --- a/src/tests/modules/cache_rbtree/cache-method-update.unlang +++ b/src/tests/modules/cache_rbtree/cache-method-update.unlang @@ -1,25 +1,25 @@ # # PRE: cache-logic # -update { - &request.Tmp-String-0 := 'testkey' +&Tmp-String-0 := 'testkey' - # Reply attributes - &reply.Reply-Message := 'hello' - &reply.Reply-Message += 'goodbye' +# Reply attributes +&reply.Reply-Message := 'hello' +&reply += { + &Reply-Message = 'goodbye' +} - # Request attributes - &Tmp-Integer-0 += 10 - &Tmp-Integer-0 += 20 - &Tmp-Integer-0 += 30 +# Request attributes +&request += { + &Tmp-Integer-0 = 10 + &Tmp-Integer-0 = 20 + &Tmp-Integer-0 = 30 } # # Basic store and retrieve # -update control { - &control.Tmp-String-1 := 'cache me' -} +&control.Tmp-String-1 := 'cache me' cache_update.store if (!updated) { @@ -76,8 +76,6 @@ if (&Tmp-String-2[2] != 'baz') { } # Clear out the reply list -update { - &reply !* ANY -} +&reply := {} test_pass diff --git a/src/tests/modules/cache_rbtree/cache-update.unlang b/src/tests/modules/cache_rbtree/cache-update.unlang index 3adbfa97f02..3153504bab4 100644 --- a/src/tests/modules/cache_rbtree/cache-update.unlang +++ b/src/tests/modules/cache_rbtree/cache-update.unlang @@ -1,25 +1,25 @@ # # PRE: cache-logic # -update { - &request.Tmp-String-0 := 'testkey' +&Tmp-String-0 := 'testkey' - # Reply attributes - &reply.Reply-Message := 'hello' - &reply.Reply-Message += 'goodbye' +# Reply attributes +&reply.Reply-Message := 'hello' +&reply += { + &Reply-Message = 'goodbye' +} - # Request attributes - &Tmp-Integer-0 += 10 - &Tmp-Integer-0 += 20 - &Tmp-Integer-0 += 30 +# Request attributes +&request += { + &Tmp-Integer-0 = 10 + &Tmp-Integer-0 = 20 + &Tmp-Integer-0 = 30 } # # Basic store and retrieve # -update control { - &control.Tmp-String-1 := 'cache me' -} +&control.Tmp-String-1 := 'cache me' cache_update if (!ok) { @@ -70,8 +70,6 @@ if (&Tmp-String-2[2] != 'baz') { } # Clear out the reply list -update { - &reply !* ANY -} +&reply := {} test_pass diff --git a/src/tests/modules/cache_rbtree/module.conf b/src/tests/modules/cache_rbtree/module.conf index 7265c49d6ec..00fa59fde95 100644 --- a/src/tests/modules/cache_rbtree/module.conf +++ b/src/tests/modules/cache_rbtree/module.conf @@ -6,8 +6,8 @@ cache { ttl = 2 update { - &request.Tmp-String-1 := &control.Tmp-String-1[0] - &request.Tmp-Integer-0 := &control.Tmp-Integer-0[0] + &Tmp-String-1 := &control.Tmp-String-1[0] + &Tmp-Integer-0 := &control.Tmp-Integer-0[0] &control += &reply } diff --git a/src/tests/modules/cache_redis/module.conf b/src/tests/modules/cache_redis/module.conf index d4b0d37ec60..bb9f0991e5e 100644 --- a/src/tests/modules/cache_redis/module.conf +++ b/src/tests/modules/cache_redis/module.conf @@ -15,8 +15,8 @@ cache { ttl = 2 update { - &request.Tmp-String-1 := &control.Tmp-String-1[0] - &request.Tmp-Integer-0 := &control.Tmp-Integer-0[0] + &Tmp-String-1 := &control.Tmp-String-1[0] + &Tmp-Integer-0 := &control.Tmp-Integer-0[0] &control += &reply } diff --git a/src/tests/modules/chap/chap_password.unlang b/src/tests/modules/chap/chap_password.unlang index 15f0bf15225..ec943811385 100644 --- a/src/tests/modules/chap/chap_password.unlang +++ b/src/tests/modules/chap/chap_password.unlang @@ -1,15 +1,10 @@ -update request { - &CHAP-Challenge := 0x0102030405060708090a0b0c0d0e0f10 - &control.Password.Cleartext := "supersecret" -} -update request { - &CHAP-Password := "%(chap_password:%{control.Password.Cleartext})" -} +&CHAP-Challenge := 0x0102030405060708090a0b0c0d0e0f10 +&control.Password.Cleartext := "supersecret" + +&CHAP-Password := "%(chap_password:%{control.Password.Cleartext})" chap.authenticate if (ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } diff --git a/src/tests/modules/cipher/fingerprint.unlang b/src/tests/modules/cipher/fingerprint.unlang index 1c55906b3df..ce1b69a61b3 100644 --- a/src/tests/modules/cipher/fingerprint.unlang +++ b/src/tests/modules/cipher/fingerprint.unlang @@ -2,9 +2,7 @@ # We can't really check the values here as the certs change periodically # but we can test the digest length, and for smoke... # -update request { - &Tmp-Octets-0 := "%(cipher_rsa_certificate:fingerprint sha1)" -} +&Tmp-Octets-0 := "%(cipher_rsa_certificate:fingerprint sha1)" if ("%(length:%{Tmp-Octets-0})" != 20) { test_fail @@ -12,9 +10,7 @@ if ("%(length:%{Tmp-Octets-0})" != 20) { test_pass } -update request { - &Tmp-Octets-0 := "%(cipher_rsa_certificate:fingerprint sha256)" -} +&Tmp-Octets-0 := "%(cipher_rsa_certificate:fingerprint sha256)" if ("%(length:%{Tmp-Octets-0})" != 32) { test_fail diff --git a/src/tests/modules/cipher/rsa_encrypt_decrypt.unlang b/src/tests/modules/cipher/rsa_encrypt_decrypt.unlang index 668cdd98b15..d7c5942d8d5 100644 --- a/src/tests/modules/cipher/rsa_encrypt_decrypt.unlang +++ b/src/tests/modules/cipher/rsa_encrypt_decrypt.unlang @@ -1,10 +1,5 @@ -update request { - &Tmp-String-0 := "Hello world!" -} - -update request { - &Tmp-Octets-0 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" -} +&Tmp-String-0 := "Hello world!" +&Tmp-Octets-0 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" if (!&Tmp-Octets-0) { test_fail @@ -20,9 +15,7 @@ else { test_pass } -update request { - &Tmp-String-1 := "%{cipher_rsa_decrypt:%{Tmp-Octets-0}}" -} +&Tmp-String-1 := "%{cipher_rsa_decrypt:%{Tmp-Octets-0}}" if (&Tmp-String-0 != &Tmp-String-1) { test_fail @@ -34,9 +27,7 @@ else { # # Padding scheme should ensure ciphertext is not consistent # -update request { - &Tmp-Octets-1 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" -} +&Tmp-Octets-1 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" if (&Tmp-Octets-0 == &Tmp-Octets-1) { test_fail @@ -48,13 +39,8 @@ else { # # Repeat tests to ensure there are no issues with EVP_PKEY_CTX reuse # -update request { - &Tmp-String-0 := "Goodbye world!" -} - -update request { - &Tmp-Octets-0 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" -} +&Tmp-String-0 := "Goodbye world!" +&Tmp-Octets-0 := "%{cipher_rsa_encrypt:%{Tmp-String-0}}" if (!&Tmp-Octets-0) { test_fail @@ -70,9 +56,7 @@ else { test_pass } -update request { - &Tmp-String-1 := "%{cipher_rsa_decrypt:%{Tmp-Octets-0}}" -} +&Tmp-String-1 := "%{cipher_rsa_decrypt:%{Tmp-Octets-0}}" if (&Tmp-String-0 != &Tmp-String-1) { test_fail diff --git a/src/tests/modules/cipher/rsa_sign_verify.unlang b/src/tests/modules/cipher/rsa_sign_verify.unlang index fe93d8da428..3c19bb850ba 100644 --- a/src/tests/modules/cipher/rsa_sign_verify.unlang +++ b/src/tests/modules/cipher/rsa_sign_verify.unlang @@ -1,10 +1,5 @@ -update request { - &Tmp-String-0 := "Hello world!" -} - -update request { - &Tmp-Octets-0 := "%{cipher_rsa_sign:%{Tmp-String-0}}" -} +&Tmp-String-0 := "Hello world!" +&Tmp-Octets-0 := "%{cipher_rsa_sign:%{Tmp-String-0}}" if (!&Tmp-Octets-0) { test_fail @@ -23,9 +18,7 @@ else { # # Pass the signature and the original message to the verification function # -update request { - &Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" -} +&Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" if (&Tmp-String-0 != 'yes') { test_fail @@ -37,12 +30,8 @@ else { # # Verification should now fail # -update request { - &Tmp-String-0 := "Goodbye world!" -} -update request { - &Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" -} +&Tmp-String-0 := "Goodbye world!" +&Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" if (&Tmp-String-0 != 'no') { test_fail @@ -54,13 +43,8 @@ else { # # Repeat tests to ensure there are no issues with EVP_PKEY_CTX reuse # -update request { - &Tmp-String-0 := "Hello nurse!" -} - -update request { - &Tmp-Octets-0 := "%{cipher_rsa_sign:%{Tmp-String-0}}" -} +&Tmp-String-0 := "Hello nurse!" +&Tmp-Octets-0 := "%{cipher_rsa_sign:%{Tmp-String-0}}" if (!&Tmp-Octets-0) { test_fail @@ -79,9 +63,7 @@ else { # # Pass the signature and the original message to the verification function # -update request { - &Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" -} +&Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" if (&Tmp-String-0 != 'yes') { test_fail @@ -93,12 +75,8 @@ else { # # Verification should now fail # -update request { - &Tmp-String-0 := "Goodbye nurse!" -} -update request { - &Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" -} +&Tmp-String-0 := "Goodbye nurse!" +&Tmp-String-0 := "%(cipher_rsa_verify:%{Tmp-Octets-0} %{Tmp-String-0})" if (&Tmp-String-0 != 'no') { test_fail diff --git a/src/tests/modules/cipher/serial.unlang b/src/tests/modules/cipher/serial.unlang index 4e496eb143c..3e85aa5d092 100644 --- a/src/tests/modules/cipher/serial.unlang +++ b/src/tests/modules/cipher/serial.unlang @@ -1,6 +1,4 @@ -update request { - &Tmp-Octets-0 := "%(cipher_rsa_certificate:serial)" -} +&Tmp-Octets-0 := "%(cipher_rsa_certificate:serial)" if ("%(length:%{Tmp-Octets-0})" != 1) { test_fail diff --git a/src/tests/modules/cipher/valid.unlang b/src/tests/modules/cipher/valid.unlang index be7e34071eb..d8aac72735d 100644 --- a/src/tests/modules/cipher/valid.unlang +++ b/src/tests/modules/cipher/valid.unlang @@ -1,7 +1,5 @@ -update request { - &Tmp-Date-0 := "%(cipher_rsa_certificate:notBefore)" - &Tmp-Date-1 := "%(cipher_rsa_certificate:notAfter)" -} +&Tmp-Date-0 := "%(cipher_rsa_certificate:notBefore)" +&Tmp-Date-1 := "%(cipher_rsa_certificate:notAfter)" # Check the cert validity period is 30 days if ("%{expr:%(integer:%{Tmp-Date-1}) - %(integer:%{Tmp-Date-0})}" != "%{expr:86400 * 60}") { diff --git a/src/tests/modules/client/xlat.unlang b/src/tests/modules/client/xlat.unlang index d705c4ab801..1cfaaadf695 100644 --- a/src/tests/modules/client/xlat.unlang +++ b/src/tests/modules/client/xlat.unlang @@ -1,30 +1,22 @@ -update request { - &Tmp-String-0 := "%(client:nas_type)" -} +&Tmp-String-0 := "%(client:nas_type)" if (&Tmp-String-0 != 'a_type') { test_fail } -update request { - &Tmp-String-0 := "%(client:nas_type 127.0.0.1)" -} +&Tmp-String-0 := "%(client:nas_type 127.0.0.1)" if (&Tmp-String-0 != 'a_type') { test_fail } -update request { - &Tmp-String-0 := "%(client:nas_type 127.0.0.2)" -} +&Tmp-String-0 := "%(client:nas_type 127.0.0.2)" if (&Tmp-String-0 != 'b_type') { test_fail } -update request { - &Tmp-String-0 := "%(client:nas_type 127.0.0.5)" -} +&Tmp-String-0 := "%(client:nas_type 127.0.0.5)" if (&Tmp-String-0 != 'b_type') { test_fail @@ -33,16 +25,14 @@ if (&Tmp-String-0 != 'b_type') { # # Test non-existent client properties # -update request { - &Tmp-String-3 := "%(client:non-existent-attr)" - &Tmp-String-4 += "%(client:non-existing-attr2)" -} +&Tmp-String-3 := "%(client:non-existent-attr)" +&Tmp-String-4 += "%(client:non-existing-attr2)" -if (&Tmp-String-3 != "") { +if (&Tmp-String-3) { test_fail } -if (&Tmp-String-4 != "") { +if (&Tmp-String-4) { test_fail } diff --git a/src/tests/modules/dict/map.unlang b/src/tests/modules/dict/map.unlang index f00c8e2b883..a51728b1484 100644 --- a/src/tests/modules/dict/map.unlang +++ b/src/tests/modules/dict/map.unlang @@ -1,7 +1,7 @@ update request { &Vendor-Specific.FreeRADIUS.Proxied-To := 127.0.0.1 - &Reply-Message := 'foo' } +&Reply-Message := 'foo' if ("%(attr_by_num:1)" != 'User-Name') { test_fail diff --git a/src/tests/modules/eap_sim/sim_xlat_id_aka.unlang b/src/tests/modules/eap_sim/sim_xlat_id_aka.unlang index c289fd5c920..bcbfeda8d6f 100644 --- a/src/tests/modules/eap_sim/sim_xlat_id_aka.unlang +++ b/src/tests/modules/eap_sim/sim_xlat_id_aka.unlang @@ -9,12 +9,8 @@ if ("%(aka_sim_id_type:%{User-Name})" != 'permanent') { # # Encrypt the permanent ID # -update control { - &Tmp-String-0 := '1420032219455258' -} -update control { - &User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" -} +&control.Tmp-String-0 := '1420032219455258' +&control.User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" # # 0.2 - Can we get the EAP method from the encrypted blob correctly? @@ -40,9 +36,7 @@ if ("%(3gpp_temporary_id_encrypt:%{control.User-Name} %{control.Tmp-String-0} 6) # # 0.5 - Get the original IMSI back again # -update control { - &Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name} %{control.Tmp-String-0})" -} +&control.Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name} %{control.Tmp-String-0})" if (&control.Tmp-String-1 != &User-Name) { test_fail @@ -52,22 +46,18 @@ if (&control.Tmp-String-1 != &User-Name) { # 1.0 Now try with the hint coming from &request.EAP-Type # if (&User-Name =~ /^[0-9](.*)/) { - update request { - &User-Name[1] := "%{1}" - } - update request { - &EAP-Type := AKA + &request += { + &User-Name = "%{1}" + &EAP-Type = AKA } } # # 1.1 - Encrypt the permanent ID # -update control { - &Tmp-String-0 := '1420032219455259' -} -update control { - &User-Name[1] := "%(3gpp_temporary_id_encrypt:%{User-Name[1]} %{control.Tmp-String-0} 6)" +&control.Tmp-String-0 := '1420032219455259' +&control += { + &User-Name = "%(3gpp_temporary_id_encrypt:%{User-Name[1]} %{control.Tmp-String-0} 6)" } # @@ -87,9 +77,7 @@ if ("%(3gpp_temporary_id_encrypt:%{control.User-Name[1]} %{control.Tmp-String-0} # # 1.4 - Get the original IMSI back again # -update control { - &Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name[1]} %{control.Tmp-String-0})" -} +&control.Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name[1]} %{control.Tmp-String-0})" if (&control.Tmp-String-1 != "0%{User-Name[1]}") { test_fail @@ -98,33 +86,29 @@ if (&control.Tmp-String-1 != "0%{User-Name[1]}") { # # 2.1 - Encrypt the permanent ID for fastauth # -update control { - &Tmp-String-0 := '1420032219455259' -} -update control { - &User-Name[1] := "%(3gpp_temporary_id_encrypt:%{User-Name[1]} %{control.Tmp-String-0} 6 fastauth)" +&control.Tmp-String-0 := '1420032219455259' +&control += { + &User-Name = "%(3gpp_temporary_id_encrypt:%{User-Name[1]} %{control.Tmp-String-0} 6 fastauth)" } # # 2.2 - Can we identify the encrypted blob correctly? # -if ("%(aka_sim_id_type:%{control.User-Name[1]})" != 'fastauth') { +if ("%(aka_sim_id_type:%{control.User-Name[2]})" != 'fastauth') { test_fail } # # 2.3 - We should refuse to re-encrypt an encrypted NAI # -if ("%(3gpp_temporary_id_encrypt:%{control.User-Name[1]} %{control.Tmp-String-0} 6 fastauth)" != '') { +if ("%(3gpp_temporary_id_encrypt:%{control.User-Name[2]} %{control.Tmp-String-0} 6 fastauth)" != '') { test_fail } # # 2.4 - Get the original IMSI back again # -update control { - &Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name[1]} %{control.Tmp-String-0})" -} +&control.Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name[2]} %{control.Tmp-String-0})" if (&control.Tmp-String-1 != "0%{User-Name[1]}") { test_fail diff --git a/src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang b/src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang index 19f5fcc7752..7a56409ca89 100644 --- a/src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang +++ b/src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang @@ -9,19 +9,13 @@ if ("%(aka_sim_id_type:%{User-Name})" != 'permanent') { # # 1.1 - Encrypt the permanent ID # -update control { - &Tmp-String-0 := '1420032219455259' -} -update control { - &User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" -} +&control.Tmp-String-0 := '1420032219455259' +&control.User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" # # 1.2 - Get the original IMSI back again sans tag # -update control { - &Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name} %{control.Tmp-String-0} false)" -} +&control.Tmp-String-1 := "%(3gpp_temporary_id_decrypt:%{control.User-Name} %{control.Tmp-String-0} false)" if ("%{User-Name}" =~ /^0(.*)/) { if (!&control.Tmp-String-1 || (&control.Tmp-String-1 == '') || (%{control.Tmp-String-1} != "%{1}")) { diff --git a/src/tests/modules/eap_sim/sim_xlat_id_error.unlang b/src/tests/modules/eap_sim/sim_xlat_id_error.unlang index e010ae90bab..d74feb4979d 100644 --- a/src/tests/modules/eap_sim/sim_xlat_id_error.unlang +++ b/src/tests/modules/eap_sim/sim_xlat_id_error.unlang @@ -1,9 +1,7 @@ # # No domain separator # -update request { - &User-Name := '14200322194552581' -} +&User-Name := '14200322194552581' if ("%(aka_sim_id_method:%{User-Name})" != '') { test_fail @@ -12,9 +10,7 @@ if ("%(aka_sim_id_method:%{User-Name})" != '') { # # Zero length ID # -update request { - &User-Name := '' -} +&User-Name := '' if ("%(aka_sim_id_method:%{User-Name})" != '') { test_fail diff --git a/src/tests/modules/eap_sim/sim_xlat_id_sim.unlang b/src/tests/modules/eap_sim/sim_xlat_id_sim.unlang index f3c62af69c3..fc56e372d64 100644 --- a/src/tests/modules/eap_sim/sim_xlat_id_sim.unlang +++ b/src/tests/modules/eap_sim/sim_xlat_id_sim.unlang @@ -9,12 +9,8 @@ if ("%(aka_sim_id_type:%{User-Name})" != 'permanent') { # # Encrypt the permanent ID # -update control { - &Tmp-String-0 := '1234567812345678' -} -update control { - &User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" -} +&control.Tmp-String-0 := '1234567812345678' +&control.User-Name := "%(3gpp_temporary_id_encrypt:%{User-Name} %{control.Tmp-String-0} 6)" # # Can we get the EAP method from the encrypted blob correctly? diff --git a/src/tests/modules/exec/async.unlang b/src/tests/modules/exec/async.unlang index 6f959af6d8f..80ebf21c13e 100644 --- a/src/tests/modules/exec/async.unlang +++ b/src/tests/modules/exec/async.unlang @@ -2,10 +2,8 @@ # Async calls should always return a zero length string # because we don't wait for the response. # -update request { - &Tmp-String-0 := "%(exec_async:/bin/sh -c 'echo -n hello')" -} -if (&Tmp-String-0 != '') { +&Tmp-String-0 := "%(exec_async:/bin/sh -c 'echo -n hello')" +if (&Tmp-String-0) { test_fail } @@ -27,9 +25,7 @@ if (&reply.Reply-Message == 'hello') { # Smoke test - Setup an async process that'll keep running after # after the test exits. # -update request { - &Tmp-String-0 := "%(exec_async:/bin/sh -c 'sleep 1')" -} -if (&Tmp-String-0 != '') { +&Tmp-String-0 := "%(exec_async:/bin/sh -c 'sleep 1')" +if (&Tmp-String-0) { test_fail } diff --git a/src/tests/modules/exec/backticks_list.unlang b/src/tests/modules/exec/backticks_list.unlang index 15e5b91a66f..6fd098c9b83 100644 --- a/src/tests/modules/exec/backticks_list.unlang +++ b/src/tests/modules/exec/backticks_list.unlang @@ -2,9 +2,7 @@ # Sync calls should always return a zero length string # because we don't wait for the response. # -update request { - &Tmp-String-0 := `/bin/sh -c 'echo hello'` -} +&Tmp-String-0 := `/bin/sh -c 'echo hello'` if (&Tmp-String-0 != 'hello') { test_fail } else { diff --git a/src/tests/modules/exec/sync.unlang b/src/tests/modules/exec/sync.unlang index 3fe37ec7339..51f8b3a01cc 100644 --- a/src/tests/modules/exec/sync.unlang +++ b/src/tests/modules/exec/sync.unlang @@ -1,9 +1,7 @@ # # Sync calls return the response # -update request { - &Tmp-String-0 := "%(exec_sync:/bin/sh -c 'echo hello')" -} +&Tmp-String-0 := "%(exec_sync:/bin/sh -c 'echo hello')" if (&Tmp-String-0 != 'hello') { test_fail } @@ -11,27 +9,25 @@ if (&Tmp-String-0 != 'hello') { # # Call something which will take longer than the timeout # -update request { - &Tmp-String-0 := "%(exec_sync:/bin/sleep 10)" -} +&request -= &Tmp-String-0 +&Tmp-String-0 := "%(exec_sync:/bin/sleep 10)" if (&Module-Failure-Message[*] != "Timeout running program - killing it and failing the request") { test_fail } -if (&Tmp-String-0 != "") { +if (&Tmp-String-0) { test_fail } -update request { - &Tmp-String-0 := "%(exec_sync:/bin/sh $ENV{MODULE_TEST_DIR}/fail.sh)" -} +&request -= &Tmp-String-0 +&Tmp-String-0 := "%(exec_sync:/bin/sh $ENV{MODULE_TEST_DIR}/fail.sh)" -if (&Tmp-String-0 != "") { +if (&Tmp-String-0) { test_fail } -if (&request.Module-Failure-Message != "Execution of external program returned 7") { +if (&Module-Failure-Message != "Execution of external program returned 7") { test_fail } diff --git a/src/tests/modules/files/authorize b/src/tests/modules/files/authorize index de4b1cece8a..733f8a7114e 100644 --- a/src/tests/modules/files/authorize +++ b/src/tests/modules/files/authorize @@ -107,6 +107,7 @@ greaterthanreply Password.Cleartext := "testing123" # Note: Filtering "!*" does not apply to control items as this would overload # the operator syntax since "!*" checks that no such attribute in the # request. +# addcontrol Password.Cleartext := "testing123", Reply-Message := "success1" Fall-Through = yes diff --git a/src/tests/modules/files/prefix.unlang b/src/tests/modules/files/prefix.unlang index 89f5eaf87ab..4347806f8d3 100644 --- a/src/tests/modules/files/prefix.unlang +++ b/src/tests/modules/files/prefix.unlang @@ -1,6 +1,4 @@ -update request { - &FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 -} +&FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 subnet @@ -17,13 +15,9 @@ if (&reply.Reply-Message[1] != "2nd 10.1/16 subnet") { } -update request { - &FreeRADIUS-Client-IP-Prefix := 10.2.3.4/32 -} +&FreeRADIUS-Client-IP-Prefix := 10.2.3.4/32 -update reply { - &Reply-Message !* ALL -} +&reply -= &Reply-Message[*] subnet @@ -33,23 +27,15 @@ if (&reply.Reply-Message != "10/8 subnet") { test_pass } -update request { - &FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 - &Password.Cleartext := "hello" -} +&FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 +&Password.Cleartext := "hello" -update reply { - &Reply-Message !* ALL -} +&reply -= &Reply-Message[*] subnet -update request { - &FreeRADIUS-Client-IP-Prefix := 192.168.1.1/32 -} +&FreeRADIUS-Client-IP-Prefix := 192.168.1.1/32 -update reply { - &Reply-Message !* ALL -} +&reply -= &Reply-Message[*] subnet diff --git a/src/tests/modules/files/subnet2.unlang b/src/tests/modules/files/subnet2.unlang index 9b9da37f30a..68366542b96 100644 --- a/src/tests/modules/files/subnet2.unlang +++ b/src/tests/modules/files/subnet2.unlang @@ -1,6 +1,4 @@ -update request { - &FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 -} +&FreeRADIUS-Client-IP-Prefix := 10.1.2.3/32 subnet2 @@ -17,13 +15,9 @@ if (&reply.Reply-Message[2] != "10/8 subnet") { } # Delete previous reply messages -update reply { - &Reply-Message !* ANY -} +&reply -= &Reply-Message[*] -update request { - &FreeRADIUS-Client-IP-Prefix := 10.2.2.3/15 -} +&FreeRADIUS-Client-IP-Prefix := 10.2.2.3/15 subnet2 diff --git a/src/tests/modules/icmp/ping.unlang b/src/tests/modules/icmp/ping.unlang index 0bd0c439ded..547d8b85d65 100644 --- a/src/tests/modules/icmp/ping.unlang +++ b/src/tests/modules/icmp/ping.unlang @@ -1,18 +1,17 @@ -update control { - &Tmp-String-0 := "%(ping:127.0.0.1)" -} +&control.Tmp-String-0 := "%(ping:127.0.0.1)" # # @todo - conditions do not yet support YIELD # if (&control.Tmp-String-0 == "yes") { - update { - &control.Password.Cleartext := "hello" - &reply.Reply-Message += "success" + &control.Password.Cleartext := "hello" + + &reply += { + &Reply-Message = "success" } } else { - update reply { - &Reply-Message += "failed" + &reply += { + &Reply-Message = "failed" } } diff --git a/src/tests/modules/idn/idn.unlang b/src/tests/modules/idn/idn.unlang index 3614f98271d..4fa52e5ccdd 100644 --- a/src/tests/modules/idn/idn.unlang +++ b/src/tests/modules/idn/idn.unlang @@ -2,14 +2,11 @@ # PRE: update if # -update request { - &Tmp-String-0 := "%{idn:example.com}" - &Tmp-String-1 := "%{idn:èxâmpłé.com}" - &Tmp-String-2 := "%{idn:пример.com}" - &Tmp-String-3 := "%{idn:παράδειγμα.com}" - &Tmp-String-4 := "%{idn:ตัวอย่าง.com}" -} - +&Tmp-String-0 := "%{idn:example.com}" +&Tmp-String-1 := "%{idn:èxâmpłé.com}" +&Tmp-String-2 := "%{idn:пример.com}" +&Tmp-String-3 := "%{idn:παράδειγμα.com}" +&Tmp-String-4 := "%{idn:ตัวอย่าง.com}" if (&Tmp-String-0 != "example.com") { test_fail @@ -31,11 +28,9 @@ if (&Tmp-String-4 != "xn--72c1a1bt4awk9o.com") { test_fail } -update request { - &Tmp-String-0 := "%{idn:invalid_example.com}" -} +&Tmp-String-0 := "%{idn:invalid_example.com}" -if (&Tmp-String-0 != "") { +if (&Module-Failure-Message != "Non-digit/letter/hyphen in input") { test_fail } @@ -43,17 +38,9 @@ if (&Module-Failure-Message == "") { test_fail } -update request { - &Module-Failure-Message !* ANY -} - -update request { - &Tmp-String-0 := "%{idn:a.véry.löng.ņàme.whîch.when.expânded.exceedş.ţhe.dns.stanđard.fór.string.łength.of.twø.hündred.ând.fifty.threé.charáctèrs.and.therefore.is.invalid.for.idn.conversion}" -} +&request -= &Module-Failure-Message[*] -if (&Tmp-String-0 != "") { - test_fail -} +&Tmp-String-0 := "%{idn:a.véry.löng.ņàme.whîch.when.expânded.exceedş.ţhe.dns.stanđard.fór.string.łength.of.twø.hündred.ând.fifty.threé.charáctèrs.and.therefore.is.invalid.for.idn.conversion}" if (&Module-Failure-Message != "Conversion was truncated") { test_fail diff --git a/src/tests/modules/imap/auth_bad_pw.unlang b/src/tests/modules/imap/auth_bad_pw.unlang index 6c5ddfadb8a..eefd0c36f90 100644 --- a/src/tests/modules/imap/auth_bad_pw.unlang +++ b/src/tests/modules/imap/auth_bad_pw.unlang @@ -1,8 +1,6 @@ imap.authenticate if (reject) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/imap/auth_bad_usr.unlang b/src/tests/modules/imap/auth_bad_usr.unlang index 6c5ddfadb8a..eefd0c36f90 100644 --- a/src/tests/modules/imap/auth_bad_usr.unlang +++ b/src/tests/modules/imap/auth_bad_usr.unlang @@ -1,8 +1,6 @@ imap.authenticate if (reject) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/imap/auth_plaintext.unlang b/src/tests/modules/imap/auth_plaintext.unlang index a400bbb9455..14cb9c837f0 100644 --- a/src/tests/modules/imap/auth_plaintext.unlang +++ b/src/tests/modules/imap/auth_plaintext.unlang @@ -1,8 +1,6 @@ imap.authenticate if (ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/imap/imap_bad_tls/auth_bad_tls.unlang b/src/tests/modules/imap/imap_bad_tls/auth_bad_tls.unlang index 055617a4bf7..916c0c68662 100644 --- a/src/tests/modules/imap/imap_bad_tls/auth_bad_tls.unlang +++ b/src/tests/modules/imap/imap_bad_tls/auth_bad_tls.unlang @@ -1,8 +1,6 @@ imap_bad_tls.authenticate if (ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/imap/imap_opt_tls/auth_try_tls.unlang b/src/tests/modules/imap/imap_opt_tls/auth_try_tls.unlang index 86ebff8999a..4ddd79c1829 100644 --- a/src/tests/modules/imap/imap_opt_tls/auth_try_tls.unlang +++ b/src/tests/modules/imap/imap_opt_tls/auth_try_tls.unlang @@ -1,6 +1,6 @@ imap_try_tls.authenticate -# if (&request.cert-attrs.Issuer) { +# if (&cert-attrs.Issuer) { # test_fail #} # else { @@ -9,15 +9,13 @@ imap_try_tls.authenticate if (ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject } -if (&request.TLS-Certificate.Issuer =~ /@example\.org/) { +if (&TLS-Certificate.Issuer =~ /@example\.org/) { test_pass } else { test_fail diff --git a/src/tests/modules/imap/imap_tls/auth_tls.unlang b/src/tests/modules/imap/imap_tls/auth_tls.unlang index eef0f5895b3..2202e5cf120 100644 --- a/src/tests/modules/imap/imap_tls/auth_tls.unlang +++ b/src/tests/modules/imap/imap_tls/auth_tls.unlang @@ -1,17 +1,15 @@ imap_tls.authenticate if (ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject } -if (&request.TLS-Certificate.Issuer =~ /@example\.org/) { - test_pass +if (&TLS-Certificate.Issuer =~ /@example\.org/) { + test_pass } else { - test_fail + test_fail } diff --git a/src/tests/modules/json/encode.unlang b/src/tests/modules/json/encode.unlang index 0d1633244fb..791692267c0 100644 --- a/src/tests/modules/json/encode.unlang +++ b/src/tests/modules/json/encode.unlang @@ -1,225 +1,143 @@ # # json_encode tests # -update { - &request.Packet-Type !* ANY -} +&request -= &Packet-Type[*] # 0. Check basic xlat parsing - -update request { - &Tmp-String-1 := "%{json_encode:&request[*]}" - &Tmp-String-2 := "%{json_encode:&request[*] }" - &Tmp-String-3 := "%{json_encode: &request[*]}" - &Tmp-String-4 := "%{json_encode: &request[*] }" - &Tmp-String-5 := "%{json_encode: &request[*] !&Filter-Id }" - &Tmp-String-6 := "%{json_encode:&request[*] ! }" +&control.Tmp-String-1 := "%{json_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_encode:&request[*] }" +&control.Tmp-String-3 := "%{json_encode: &request[*]}" +&control.Tmp-String-4 := "%{json_encode: &request[*] }" +&control.Tmp-String-5 := "%{json_encode: &request[*] !&Filter-Id }" +&control.Tmp-String-6 := "%{json_encode:&request[*] ! }" # Check defaults are the same as output_mode "object": - &Tmp-String-7 := "%{json_object_encode:&request[*]}" - &Tmp-String-8 := "%{json_object_no_encode:&request[*]}" -} +&control.Tmp-String-7 := "%{json_object_encode:&request[*]}" +&control.Tmp-String-8 := "%{json_object_no_encode:&request[*]}" - -if (&Tmp-String-1 != '{"User-Name":{"type":"string","value":"john"},"Filter-Id":{"type":"string","value":["f1","f2"]},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { +if (&control.Tmp-String-1 != '{"User-Name":{"type":"string","value":"john"},"Filter-Id":{"type":"string","value":["f1","f2"]},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { test_fail } # Check xlat input formats -if (&Tmp-String-1 != &Tmp-String-2 || - &Tmp-String-1 != &Tmp-String-3 || - &Tmp-String-1 != &Tmp-String-4) { +if (&control.Tmp-String-1 != &control.Tmp-String-2 || + &control.Tmp-String-1 != &control.Tmp-String-3 || + &control.Tmp-String-1 != &control.Tmp-String-4) { test_fail } # Check defaults -if (&Tmp-String-1 != &Tmp-String-7 || - &Tmp-String-1 != &Tmp-String-8) { +if (&control.Tmp-String-1 != &control.Tmp-String-7 || + &control.Tmp-String-1 != &control.Tmp-String-8) { test_fail } -if (&Tmp-String-5 != '{"User-Name":{"type":"string","value":"john"},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { +if (&control.Tmp-String-5 != '{"User-Name":{"type":"string","value":"john"},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { test_fail } -if (&Tmp-String-6 != '') { +if (&control.Tmp-String-6) { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Tmp-String-3 !* ANY - &Tmp-String-4 !* ANY - &Tmp-String-5 !* ANY - &Tmp-String-6 !* ANY - &Tmp-String-7 !* ANY - &Tmp-String-8 !* ANY -} - - # 1a. Output mode "object" tests # These are unsorted dictionaries. Hopefully json-c doesn't suddenly # decide that it's going to use a different ordering of the keys... +&control.Tmp-String-1 := "%{json_object_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_object_ex_encode:&request[*]}" -update request { - &Tmp-String-1 := "%{json_object_encode:&request[*]}" - &Tmp-String-2 := "%{json_object_ex_encode:&request[*]}" -} - -if (&Tmp-String-1 != '{"User-Name":{"type":"string","value":"john"},"Filter-Id":{"type":"string","value":["f1","f2"]},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { +if (&control.Tmp-String-1 != '{"User-Name":{"type":"string","value":"john"},"Filter-Id":{"type":"string","value":["f1","f2"]},"NAS-Port":{"type":"uint32","value":999},"Service-Type":{"type":"uint32","value":"Login-User"}}') { test_fail } -if (&Tmp-String-2 != '{"pf:User-Name":{"type":"string","value":["john"]},"pf:Filter-Id":{"type":"string","value":["f1","f2"]},"pf:NAS-Port":{"type":"uint32","value":["999"]},"pf:Service-Type":{"type":"uint32","value":["1"]}}') { +"%{control.Tmp-String-2}" +if (&control.Tmp-String-2 != '{"pf:User-Name":{"type":"string","value":["john"]},"pf:Filter-Id":{"type":"string","value":["f1","f2"]},"pf:NAS-Port":{"type":"uint32","value":["999"]},"pf:Service-Type":{"type":"uint32","value":["1"]}}') { test_fail } # 1b. "object" empty inputs +&control.Tmp-String-1 := "%{json_object_encode:!&request[*]}" -update request { - &Tmp-String-1 := "%{json_object_encode:!&request[*]}" -} - -if (&Tmp-String-1 != '{}') { +if (&control.Tmp-String-1 != '{}') { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Module-Failure-Message !* ANY -} - - # 2a. Output mode "object_simple" tests +&control.Tmp-String-1 := "%{json_object_simple_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_object_simple_ex_encode:&request[*]}" -update request { - &Tmp-String-1 := "%{json_object_simple_encode:&request[*]}" - &Tmp-String-2 := "%{json_object_simple_ex_encode:&request[*]}" -} - -if (&Tmp-String-1 != '{"User-Name":"john","Filter-Id":["f1","f2"],"NAS-Port":999,"Service-Type":"Login-User"}') { +if (&control.Tmp-String-1 != '{"User-Name":"john","Filter-Id":["f1","f2"],"NAS-Port":999,"Service-Type":"Login-User"}') { test_fail } -if (&Tmp-String-2 != '{"pf:User-Name":["john"],"pf:Filter-Id":["f1","f2"],"pf:NAS-Port":["999"],"pf:Service-Type":["1"]}') { +if (&control.Tmp-String-2 != '{"pf:User-Name":["john"],"pf:Filter-Id":["f1","f2"],"pf:NAS-Port":["999"],"pf:Service-Type":["1"]}') { test_fail } # 2b. "object_simple" empty inputs +&control.Tmp-String-1 := "%{json_object_simple_encode:!&request[*]}" -update request { - &Tmp-String-1 := "%{json_object_simple_encode:!&request[*]}" -} - -if (&Tmp-String-1 != '{}') { +if (&control.Tmp-String-1 != '{}') { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Module-Failure-Message !* ANY -} - - # 3a. Output mode "array" tests +&control.Tmp-String-1 := "%{json_array_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_array_ex_encode:&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_encode:&request[*]}" - &Tmp-String-2 := "%{json_array_ex_encode:&request[*]}" -} - -if (&Tmp-String-1 != '[{"name":"User-Name","type":"string","value":"john"},{"name":"Filter-Id","type":"string","value":"f1"},{"name":"Filter-Id","type":"string","value":"f2"},{"name":"NAS-Port","type":"uint32","value":999},{"name":"Service-Type","type":"uint32","value":"Login-User"}]') { +if (&control.Tmp-String-1 != '[{"name":"User-Name","type":"string","value":"john"},{"name":"Filter-Id","type":"string","value":"f1"},{"name":"Filter-Id","type":"string","value":"f2"},{"name":"NAS-Port","type":"uint32","value":999},{"name":"Service-Type","type":"uint32","value":"Login-User"}]') { test_fail } -if (&Tmp-String-2 != '[{"name":"pf:User-Name","type":"string","value":["john"]},{"name":"pf:Filter-Id","type":"string","value":["f1","f2"]},{"name":"pf:NAS-Port","type":"uint32","value":["999"]},{"name":"pf:Service-Type","type":"uint32","value":["1"]}]') { +if (&control.Tmp-String-2 != '[{"name":"pf:User-Name","type":"string","value":["john"]},{"name":"pf:Filter-Id","type":"string","value":["f1","f2"]},{"name":"pf:NAS-Port","type":"uint32","value":["999"]},{"name":"pf:Service-Type","type":"uint32","value":["1"]}]') { test_fail } # 3b. "array" empty inputs +&control.Tmp-String-1 := "%{json_array_encode:!&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_encode:!&request[*]}" -} - -if (&Tmp-String-1 != '[]') { +if (&control.Tmp-String-1 != '[]') { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Module-Failure-Message !* ANY -} - - # 4a. Output mode "array_of_names" tests +&control.Tmp-String-1 := "%{json_array_names_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_array_names_ex_encode:&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_names_encode:&request[*]}" - &Tmp-String-2 := "%{json_array_names_ex_encode:&request[*]}" -} - -if (&Tmp-String-1 != '["User-Name","Filter-Id","Filter-Id","NAS-Port","Service-Type"]') { +if (&control.Tmp-String-1 != '["User-Name","Filter-Id","Filter-Id","NAS-Port","Service-Type"]') { test_fail } -if (&Tmp-String-2 != '["pf:User-Name","pf:Filter-Id","pf:Filter-Id","pf:NAS-Port","pf:Service-Type"]') { +if (&control.Tmp-String-2 != '["pf:User-Name","pf:Filter-Id","pf:Filter-Id","pf:NAS-Port","pf:Service-Type"]') { test_fail } # 4b. "array_of_names" empty inputs +&control.Tmp-String-1 := "%{json_array_names_encode:!&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_names_encode:!&request[*]}" -} - -if (&Tmp-String-1 != '[]') { +if (&control.Tmp-String-1 != '[]') { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Module-Failure-Message !* ANY -} - - # 5a. Output mode "array_of_values" tests +&control.Tmp-String-1 := "%{json_array_values_encode:&request[*]}" +&control.Tmp-String-2 := "%{json_array_values_ex_encode:&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_values_encode:&request[*]}" - &Tmp-String-2 := "%{json_array_values_ex_encode:&request[*]}" -} - -if (&Tmp-String-1 != '["john","f1","f2",999,"Login-User"]') { +if (&control.Tmp-String-1 != '["john","f1","f2",999,"Login-User"]') { test_fail } -if (&Tmp-String-2 != '["john","f1","f2","999","1"]') { +if (&control.Tmp-String-2 != '["john","f1","f2","999","1"]') { test_fail } # 5b. "array_of_values" empty inputs +&control.Tmp-String-1 := "%{json_array_values_encode:!&request[*]}" -update request { - &Tmp-String-1 := "%{json_array_values_encode:!&request[*]}" -} - -if (&Tmp-String-1 != '[]') { +if (&control.Tmp-String-1 != '[]') { test_fail } -update request { - &Tmp-String-1 !* ANY - &Tmp-String-2 !* ANY - &Module-Failure-Message !* ANY -} - - # Convert `make json.test` unlang update output to tests, for when # things need updating. # diff --git a/src/tests/modules/json/encode_error.unlang b/src/tests/modules/json/encode_error.unlang index 33abfb3993f..6356f0ad5c7 100644 --- a/src/tests/modules/json/encode_error.unlang +++ b/src/tests/modules/json/encode_error.unlang @@ -2,6 +2,4 @@ # json xlat input parsing test - error with no input # -update request { - &Tmp-String-1 := "%{json_object_ex_encode:}" # ERROR -} +&Tmp-String-1 := "%{json_object_ex_encode:}" # ERROR diff --git a/src/tests/modules/json/eval.unlang b/src/tests/modules/json/eval.unlang index faedb8c1f07..c09dfd3a0b5 100644 --- a/src/tests/modules/json/eval.unlang +++ b/src/tests/modules/json/eval.unlang @@ -2,9 +2,7 @@ # Evaluation tests # -update request { - &Tmp-String-0 := "{\"foo\":\"bar\"}" -} +&Tmp-String-0 := "{\"foo\":\"bar\"}" # 0. Simple field access map json &Tmp-String-0 { @@ -15,25 +13,21 @@ if (&Tmp-String-1 != 'bar') { test_fail } -update request { - &Tmp-String-0 := "\ - {\ - \"my_array\": [0, 1, 2, 3, 4, 5], \ - \"my_object\": { \ - \"foo\": \"bar\", \ - \"num\" : 42 \ - }, \ - \"num\": 99, \ - \"double\": 5.9, \ - \"null\": null, \ - \"bool_true\": true, \ - \"bool_false\": false \ - }" -} +&Tmp-String-0 := "\ +{\ + \"my_array\": [0, 1, 2, 3, 4, 5], \ + \"my_object\": { \ + \"foo\": \"bar\", \ + \"num\" : 42 \ + }, \ + \"num\": 99, \ + \"double\": 5.9, \ + \"null\": null, \ + \"bool_true\": true, \ + \"bool_false\": false \ +}" -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # Check conversion of all JSON types to strings map json &Tmp-String-0 { @@ -75,9 +69,7 @@ if (&Tmp-String-1[6] != 'no') { test_fail } -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # # Now check array slicing operates correctly @@ -90,9 +82,8 @@ map json &Tmp-String-0 { if (&Tmp-String-1 != '[ 0, 1, 2, 3, 4, 5 ]') { test_fail } -update request { - &Tmp-String-1 !* ANY -} + +&request -= &Tmp-String-1[*] # 9. Simple index map json &Tmp-String-0 { @@ -101,9 +92,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0 != 0) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 9a. All of the array map json &Tmp-String-0 { @@ -113,9 +103,8 @@ if ((&Tmp-Integer-0[0] != 0) || (&Tmp-Integer-0[1] != 1) || (&Tmp-Integer-0[2] ! test_fail } -update request { - &Tmp-Integer-0 := 9 -} +&Tmp-Integer-0 := 9 + # 9b. All of the array using prepend, places the array before the existing value map json &Tmp-String-0 { &Tmp-Integer-0 ^= '$.my_array.*' @@ -123,9 +112,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 0) || (&Tmp-Integer-0[1] != 1) || (&Tmp-Integer-0[2] != 2) || (&Tmp-Integer-0[3] != 3) || (&Tmp-Integer-0[4] != 4) || (&Tmp-Integer-0[5] != 5) || (&Tmp-Integer-0[6] != 9)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 10. End of the array map json &Tmp-String-0 { @@ -134,9 +122,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0 != 5) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 11. Past end of the array map json &Tmp-String-0 { @@ -145,9 +132,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 12. Simple slice map json &Tmp-String-0 { @@ -156,9 +142,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 0) || (&Tmp-Integer-0[1] != 1)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 13. Slice with negative start map json &Tmp-String-0 { @@ -167,9 +152,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0 != 5) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 14. Slice with negative start and negative end map json &Tmp-String-0 { @@ -186,9 +170,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 1) && (&Tmp-Integer-0[1] != 2)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 16. Slice with start, end and negative step map json &Tmp-String-0 { @@ -197,9 +180,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 4) || (&Tmp-Integer-0[1] != 3)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 17. Slice with start, end (inverted) and negative step map json &Tmp-String-0 { @@ -208,9 +190,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 18. Slice with start, end and positive step map json &Tmp-String-0 { @@ -219,9 +200,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 2) || (&Tmp-Integer-0[1] != 3)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 19. Slice with start, end and positive step > 1 map json &Tmp-String-0 { @@ -230,9 +210,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 1) && (&Tmp-Integer-0[1] != 3)) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 20. Slice with start, end and positive step > end of array map json &Tmp-String-0 { @@ -241,9 +220,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 1) || &Tmp-Integer-0[1]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 21. Slice with start, end and positive step > end of array map json &Tmp-String-0 { @@ -252,9 +230,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 5) || &Tmp-Integer-0[1]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 22. No start/end 3 step map json &Tmp-String-0 { @@ -263,9 +240,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 0) || (&Tmp-Integer-0[1] != 3) || &Tmp-Integer-0[2]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 23. No start/end 3 step map json &Tmp-String-0 { @@ -274,9 +250,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 5) || (&Tmp-Integer-0[1] != 2) || &Tmp-Integer-0[2]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 24. No end 3 step map json &Tmp-String-0 { @@ -285,9 +260,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 3) || (&Tmp-Integer-0[1] != 0) || &Tmp-Integer-0[2]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 25. End 0, 3 step map json &Tmp-String-0 { @@ -296,9 +270,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 3) || &Tmp-Integer-0[1]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 26. End 0, 3 step map json &Tmp-String-0 { @@ -307,9 +280,8 @@ map json &Tmp-String-0 { if ((&Tmp-Integer-0[0] != 0) || &Tmp-Integer-0[1]) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 27. Everything two levels deep map json &Tmp-String-0 { @@ -327,9 +299,7 @@ if ((&Tmp-String-1[0] != '0') || \ test_fail } -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # 28. Everything three levels deep (nothing) map json &Tmp-String-0 { @@ -359,19 +329,17 @@ if (&Tmp-String-1) { } # Some big numbers in nested arrays -update request { - &Tmp-String-0 := "\ - [\ - 9223372036854775807, \ - -9223372036854775807, \ - 18446744073709551615, \ - [ \ - 2147483647, \ - -2147483647, \ - 4294967295, \ - ] \ - ]" -} +&Tmp-String-0 := "\ +[\ + 9223372036854775807, \ + -9223372036854775807, \ + 18446744073709551615, \ + [ \ + 2147483647, \ + -2147483647, \ + 4294967295, \ + ] \ +]" # 31. Unsigned 32bit integers (are supported) # Will get smushed to INT32_MAX with json-c <= 0.10, or might wrap, it's @@ -395,9 +363,8 @@ map json &Tmp-String-0 { if (&Tmp-Integer-0 != 2147483647) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} + +&request -= &Tmp-Integer-0[*] # 33. Signed 64bit integers map json &Tmp-String-0 { @@ -406,9 +373,8 @@ map json &Tmp-String-0 { if (&Tmp-int64-0 != 9223372036854775807) { test_fail } -update request { - &Tmp-int64-0 !* ANY -} + +&request -= &Tmp-int64-0[*] # 34. Signed 64bit integers map json &Tmp-String-0 { @@ -417,9 +383,8 @@ map json &Tmp-String-0 { if (&Tmp-int64-0 != -9223372036854775807) { test_fail } -update request { - &Tmp-int64-0 !* ANY -} + +&request -= &Tmp-int64-0[*] # 35. Unsigned 64bit integers (not allowed by json so gets truncated) map json &Tmp-String-0 { @@ -428,9 +393,8 @@ map json &Tmp-String-0 { if (&Tmp-uint64-0 != 9223372036854775807) { test_fail } -update request { - &Tmp-uint64-0 !* ANY -} + +&request -= &Tmp-uint64-0[*] # 36. Multiple array indicies map json &Tmp-String-0 { @@ -439,32 +403,27 @@ map json &Tmp-String-0 { if ((&Tmp-Signed-0[0] != 2147483647) || (&Tmp-signed-0[1] != -2147483647)) { test_fail } -update request { - &Tmp-Signed-0 !* ANY -} + +&request -= &Tmp-Signed-0[*] # 37. Path containing dynamic expansion -update request { - &Tmp-Integer-2 := 0 -} +&Tmp-Integer-2 := 0 + map json &Tmp-String-0 { &Tmp-Integer-0 += "$[3][%{Tmp-Integer-2}]" } if (&Tmp-Integer-0 != 2147483647) { test_fail } -update request { - &Tmp-Integer-0 !* ANY -} +&request -= &Tmp-Integer-0[*] # 38. An expanded field name with bad chars -update request { - &Tmp-String-0 := "\ - {\ - \"foo.bar\": \"baz\" \ - }" - &Tmp-String-2 := %{taint:foo.bar} -} +&Tmp-String-0 := "\ +{\ + \"foo.bar\": \"baz\" \ +}" +&Tmp-String-2 := "%{taint:foo.bar}" + map json &Tmp-String-0 { &Tmp-String-1 := "$.%{Tmp-String-2}" } @@ -472,46 +431,43 @@ map json &Tmp-String-0 { if (&Tmp-String-1 != 'baz') { test_fail } -update request { - &Tmp-String-1 !* ANY -} - -update request { - &Tmp-String-0 := "\ - {\ - \"my_array\": [0, 1, 2, 3, 4, 5], \ - \"my_object\": { \ - \"foo\": \"bar\", \ - \"num\" : 42, \ - \"my_deep_object\": { \ - \"foo\": \"baz\", \ - \"num\": 99, \ - \"bool\": true\ - }, \ - \"my_cats\": [\ - \"fluffy\", \ - \"scratchy\", \ - \"flat\" \ - ], \ + +&request -= &Tmp-String-1[*] + +&Tmp-String-0 := "\ +{\ + \"my_array\": [0, 1, 2, 3, 4, 5], \ + \"my_object\": { \ + \"foo\": \"bar\", \ + \"num\" : 42, \ + \"my_deep_object\": { \ + \"foo\": \"baz\", \ + \"num\": 99, \ + \"bool\": true\ }, \ \"my_cats\": [\ - \"spikey\", \ - \"clawy\", \ - \"woofy\" \ + \"fluffy\", \ + \"scratchy\", \ + \"flat\" \ ], \ - }" -} + }, \ + \"my_cats\": [\ + \"spikey\", \ + \"clawy\", \ + \"woofy\" \ + ], \ +}" # 39. Recursive descent with field match map json &Tmp-String-0 { &Tmp-String-1 += '$..bool' } + if (("%{Tmp-String-1[#]}" != 1) || (&Tmp-String-1 != 'yes')) { test_fail } -update request { - &Tmp-String-1 !* ANY -} + +&request -= &Tmp-String-1[*] # 40. Recursive descent with element match (2nd element in each array) map json &Tmp-String-0 { @@ -520,9 +476,7 @@ map json &Tmp-String-0 { if (("%{Tmp-String-1[#]}" != 3) || (&Tmp-String-1[0] != '1') || (&Tmp-String-1[1] != 'scratchy') || (&Tmp-String-1[2] != 'clawy')) { test_fail } -update request { - &Tmp-String-1 !* ANY -} +&request -= &Tmp-String-1[*] # 41. Recursive descent with field then element match map json &Tmp-String-0 { @@ -531,8 +485,7 @@ map json &Tmp-String-0 { if (("%{Tmp-String-1[#]}" != 2) || (&Tmp-String-1[0] != 'flat') || (&Tmp-String-1[1] != 'woofy')) { test_fail } -update request { - &Tmp-String-1 !* ANY -} + +&request -= &Tmp-String-1[*] test_pass diff --git a/src/tests/modules/json/quote.unlang b/src/tests/modules/json/quote.unlang index 58fe477f57d..d99017547c8 100644 --- a/src/tests/modules/json/quote.unlang +++ b/src/tests/modules/json/quote.unlang @@ -1,15 +1,10 @@ # # JSON quoting # - -update request { - &Tmp-String-0 := 'foo/bar' - &Tmp-String-1 := 'foo"bar' -} -update request { - &Tmp-String-2 := "%{jsonquote:%{Tmp-String-0}}" - &Tmp-String-3 := "%{jsonquote:%{Tmp-String-1}}" -} +&Tmp-String-0 := 'foo/bar' +&Tmp-String-1 := 'foo"bar' +&Tmp-String-2 := "%{jsonquote:%{Tmp-String-0}}" +&Tmp-String-3 := "%{jsonquote:%{Tmp-String-1}}" # Check for correct escapes if (&Tmp-String-2 != 'foo\/bar') { @@ -24,14 +19,10 @@ if (&Module-Failure-Message) { test_fail } - # Check for correct handling of null input +&Tmp-String-4 := "%{jsonquote:}" -update request { - &Tmp-String-4 := "%{jsonquote:}" -} - -if (&Tmp-String-4 != '') { +if (&Tmp-String-4) { test_fail } diff --git a/src/tests/modules/ldap/acct.unlang b/src/tests/modules/ldap/acct.unlang index 004a2f31dce..b859c31ab95 100644 --- a/src/tests/modules/ldap/acct.unlang +++ b/src/tests/modules/ldap/acct.unlang @@ -8,9 +8,7 @@ if (!ok) { test_fail } -update { - &Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" -} +&Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" if (&Tmp-String-0 != "User john is online") { test_fail diff --git a/src/tests/modules/ldap/auth.unlang b/src/tests/modules/ldap/auth.unlang index 04d2fc904f8..e2309b2e410 100644 --- a/src/tests/modules/ldap/auth.unlang +++ b/src/tests/modules/ldap/auth.unlang @@ -42,9 +42,7 @@ ldap.authenticate ldap.post-auth -update { - &Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" -} +&Tmp-String-0 := "%{ldap:ldap://$ENV{TEST_SERVER}/uid=john,ou=people,dc=example,dc=com?description}" if (&Tmp-String-0 != "User %{User-Name} authenticated") { test_fail diff --git a/src/tests/modules/ldap/auth_ssl.unlang b/src/tests/modules/ldap/auth_ssl.unlang index e0c322b005f..dd148ed783a 100644 --- a/src/tests/modules/ldap/auth_ssl.unlang +++ b/src/tests/modules/ldap/auth_ssl.unlang @@ -29,9 +29,7 @@ ldapssl.authenticate ldapssl.post-auth -update { - &Tmp-String-0 := "%{ldapssl:ldaps:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" -} +&Tmp-String-0 := "%{ldapssl:ldaps:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" if (&Tmp-String-0 != "User %{User-Name} authenticated") { test_fail diff --git a/src/tests/modules/ldap/auth_starttls.unlang b/src/tests/modules/ldap/auth_starttls.unlang index 6f838e8bcd8..e1eefc3951d 100644 --- a/src/tests/modules/ldap/auth_starttls.unlang +++ b/src/tests/modules/ldap/auth_starttls.unlang @@ -30,9 +30,7 @@ ldaptls.authenticate ldaptls.post-auth -update { - &Tmp-String-0 := "%{ldaptls:ldap:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" -} +&Tmp-String-0 := "%{ldaptls:ldap:///uid=fred,ou=people,dc=subdept,dc=example,dc=com?description}" if (&Tmp-String-0 != "User %{User-Name} authenticated") { test_fail diff --git a/src/tests/modules/ldap/map.unlang b/src/tests/modules/ldap/map.unlang index 2dda4f20a80..879d4851f10 100644 --- a/src/tests/modules/ldap/map.unlang +++ b/src/tests/modules/ldap/map.unlang @@ -7,15 +7,15 @@ if (!updated) { test_fail } -if (&request.Tmp-String-0 != '255.255.255.0') { +if (&Tmp-String-0 != '255.255.255.0') { test_fail } -if (&request.Tmp-String-1[*] != 'cn=radprofile,ou=profiles,dc=example,dc=com') { +if (&Tmp-String-1[*] != 'cn=radprofile,ou=profiles,dc=example,dc=com') { test_fail } -if (&request.Tmp-String-1[*] != 'cn=profile1,ou=profiles,dc=example,dc=com') { +if (&Tmp-String-1[*] != 'cn=profile1,ou=profiles,dc=example,dc=com') { test_fail } diff --git a/src/tests/modules/ldap/xlat.unlang b/src/tests/modules/ldap/xlat.unlang index 7a9eac1cef2..8a595387991 100644 --- a/src/tests/modules/ldap/xlat.unlang +++ b/src/tests/modules/ldap/xlat.unlang @@ -2,102 +2,78 @@ # Test the "ldap" module xlat escape functions # -update request { - &Tmp-String-0 := "safe string" - &Tmp-String-1 := 'non safe,+"\<>;*=() string' - &Tmp-String-2 := ',+"\<>;*=()' -} +&Tmp-String-0 := "safe string" +&Tmp-String-1 := 'non safe,+"\<>;*=() string' +&Tmp-String-2 := ',+"\<>;*=()' # String with no escaping -update control { - &Tmp-String-0 := "%{ldap_escape:%{Tmp-String-0}}" -} +&control.Tmp-String-0 := "%{ldap_escape:%{Tmp-String-0}}" if (&control.Tmp-String-0 != "safe string") { test_fail } # String with some characters to escape -update control { - &Tmp-String-1 := "%{ldap_escape:%{Tmp-String-1}}" -} +&control.Tmp-String-1 := "%{ldap_escape:%{Tmp-String-1}}" if (&control.Tmp-String-1 != 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string') { test_fail } # String where all characters require escaping -update control { - &Tmp-String-2 := "%{ldap_escape:%{Tmp-String-2}}" -} +&control.Tmp-String-2 := "%{ldap_escape:%{Tmp-String-2}}" if (&control.Tmp-String-2 != '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29') { test_fail } -update request { - &Tmp-String-3 := "%{ldap_unescape:%{control.Tmp-String-0}}" -} +&Tmp-String-3 := "%{ldap_unescape:%{control.Tmp-String-0}}" if (&Tmp-String-3 != 'safe string') { test_fail } -update request { - &Tmp-String-4 := "%{ldap_unescape:%{control.Tmp-String-1}}" -} +&Tmp-String-4 := "%{ldap_unescape:%{control.Tmp-String-1}}" if (&Tmp-String-4 != 'non safe,+"\<>;*=() string') { test_fail } -update request { - &Tmp-String-5 := "%{ldap_unescape:%{control.Tmp-String-2}}" -} +&Tmp-String-5 := "%{ldap_unescape:%{control.Tmp-String-2}}" if (&Tmp-String-5 != ',+"\<>;*=()') { test_fail } -update request { - &Tmp-String-6 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=john)}" -} +&Tmp-String-6 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=john)}" if (&Tmp-String-6 != "John Doe") { test_fail } # Return multiple values - could be in any sequence -update request { - &Tmp-String-7 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=clients,dc=example,dc=com?radiusClientIdentifier?sub?(objectClass=radiusClient)}" -} +&Tmp-String-7 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=clients,dc=example,dc=com?radiusClientIdentifier?sub?(objectClass=radiusClient)}" if ((&Tmp-String-7 != "1.1.1.12.2.2.2") && (&Tmp-String-7 != "2.2.2.21.1.1.1")) { test_fail } # Use tainted string in filter - with special characters -update request { - &Tmp-String-8 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?cn?sub?(displayName=*%{Tmp-String-9}*)}" -} +&Tmp-String-8 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?cn?sub?(displayName=*%{Tmp-String-9}*)}" if (&Tmp-String-8 != "Bob Smith") { test_fail } # A query which should return no results -update request { - &Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=notknown)}" -} +&Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=people,dc=example,dc=com?displayName?sub?(uid=notknown)}" if (&Tmp-String-0 != "") { test_fail } # Request an invalid DN -update request { - &Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=notthere?displayName?sub?(uid=john)}" -} +&Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=notthere?displayName?sub?(uid=john)}" if (&Tmp-String-0 != "") { test_fail @@ -108,36 +84,28 @@ if (&Module-Failure-Message != "LDAP server returned an error: lib error: No suc } # Query within a dn which will prompt a referral -update request { - &Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" -} +&Tmp-String-0 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" if (&Tmp-String-0 != "Fred Jones") { test_fail } # Reference an alternative LDAP server in the xlat -update request { - &Tmp-String-1 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:%{expr:$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" -} +&Tmp-String-1 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:%{expr:$ENV{LDAP_TEST_SERVER_PORT} + 1}/dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" if (&Tmp-String-1 != "Fred Jones") { test_fail } # This query will follow 2 referrals, the second will present an alternate search base -update request { - &Tmp-String-2 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=offsite,dc=subdept,dc=example,dc=com?displayName?sub?(uid=john)}" -} +&Tmp-String-2 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=offsite,dc=subdept,dc=example,dc=com?displayName?sub?(uid=john)}" if (&Tmp-String-2 != "John Doe") { test_fail } # This query will follow 3 referrals - more than our max referral depth -update request { - &Tmp-String-3 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=bounce1,dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" -} +&Tmp-String-3 := "%{ldap:ldap://$ENV{LDAP_TEST_SERVER}:$ENV{LDAP_TEST_SERVER_PORT}/ou=bounce1,dc=subdept,dc=example,dc=com?displayName?sub?(uid=fred)}" if (&Tmp-String-3 != "") { test_fail diff --git a/src/tests/modules/linelog/linelog-delim.unlang b/src/tests/modules/linelog/linelog-delim.unlang index b286b77ac97..760b5803e90 100644 --- a/src/tests/modules/linelog/linelog-delim.unlang +++ b/src/tests/modules/linelog/linelog-delim.unlang @@ -1,14 +1,10 @@ -update control { - &Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' -} +&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' # # Remove old log files # group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_delim.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_delim.log"` # # We can only over-ride actions in an "actions" subsection, @@ -23,9 +19,7 @@ if (fail) { } linelog_fmt_delim -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` if (&Tmp-String-0 == 'bob, ') { test_pass @@ -36,9 +30,7 @@ else { # Check strings are appended linelog_fmt_delim -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` if (&Tmp-String-0 == 'bob, bob, ') { test_pass @@ -48,6 +40,4 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_delim.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_delim.log"` diff --git a/src/tests/modules/linelog/linelog-escapes.unlang b/src/tests/modules/linelog/linelog-escapes.unlang index 4acad2340a0..d1226cedff0 100644 --- a/src/tests/modules/linelog/linelog-escapes.unlang +++ b/src/tests/modules/linelog/linelog-escapes.unlang @@ -1,15 +1,10 @@ - -update control { - &Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' -} +&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' # # Remove old log files # group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_escapes.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_escapes.log"` actions { fail = 1 @@ -21,18 +16,12 @@ if (fail) { # Raw attribute value should be written out without further molestation. # Because the value is wrapped in '' the \n is left as \n. -update control { - &Tmp-String-0 := 'test_attr' - &Tmp-String-1 := 'foo\nbar' -} +&control.Tmp-String-0 := 'test_attr' +&control.Tmp-String-1 := 'foo\nbar' linelog_escapes -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n2 $ENV{MODULE_TEST_DIR}/test_escapes.log"` -} -update request { - &Tmp-String-1 := "%{hex:%{Tmp-String-0}}" -} +&Tmp-String-0 := `/bin/sh -c "tail -n2 $ENV{MODULE_TEST_DIR}/test_escapes.log"` +&Tmp-String-1 := "%{hex:%{Tmp-String-0}}" # # Note that there's a '5f6e' here, which is "\n" @@ -45,9 +34,7 @@ else { test_fail } -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` # # This is left alone, and not "\n" --> 0x0a, too. @@ -61,18 +48,13 @@ else { # Raw attribute value should be written out without further molestation. # Because the value is wrapped in "" the \n is converted to 0x0a (binary). -update control { - &Tmp-String-0 := 'test_attr' - &Tmp-String-1 := "foo\nbar" -} +&control.Tmp-String-0 := 'test_attr' +&control.Tmp-String-1 := "foo\nbar" linelog_escapes -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n2 $ENV{MODULE_TEST_DIR}/test_escapes.log"` -} -update request { - &Tmp-String-1 := "%{hex:%{Tmp-String-0}}" -} +&Tmp-String-0 := `/bin/sh -c "tail -n2 $ENV{MODULE_TEST_DIR}/test_escapes.log"` +&Tmp-String-1 := "%{hex:%{Tmp-String-0}}" + if (&Tmp-String-1 == '666f6f0a626172') { test_pass } @@ -80,9 +62,8 @@ else { test_fail } -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` + if (&Tmp-String-0 == "bar") { test_pass } @@ -93,6 +74,4 @@ else { # Fixme... needs completing. Too many broken escaping things. # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_escapes.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_escapes.log"` diff --git a/src/tests/modules/linelog/linelog-multi.unlang b/src/tests/modules/linelog/linelog-multi.unlang index 18387435644..d4e7adecea6 100644 --- a/src/tests/modules/linelog/linelog-multi.unlang +++ b/src/tests/modules/linelog/linelog-multi.unlang @@ -1,14 +1,10 @@ -update control { - &Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' -} +&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' # # Remove old log files # group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_multi.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_multi.log"` actions { fail = 1 @@ -19,28 +15,24 @@ if (fail) { } # Check multiple string type attributes are logged correctly -update control { - &Tmp-String-0 := 'test_multi_str' -} +&control.Tmp-String-0 := 'test_multi_str' -update control { - &Reply-Message := '0' - &Reply-Message += '1' - &Reply-Message += '2' - &Reply-Message += '3' - &Reply-Message += '4' - &Reply-Message += '5' - &Reply-Message += '6' - &Reply-Message += '7' - &Reply-Message += '8' - &Reply-Message += '9' - &Reply-Message += '10' +&control += { + &Reply-Message = '0' + &Reply-Message = '1' + &Reply-Message = '2' + &Reply-Message = '3' + &Reply-Message = '4' + &Reply-Message = '5' + &Reply-Message = '6' + &Reply-Message = '7' + &Reply-Message = '8' + &Reply-Message = '9' + &Reply-Message = '10' } linelog_ref_multi -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` if (&Tmp-String-0 == '0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ') { test_pass @@ -50,19 +42,17 @@ else { } # Check octet type attributes are logged in raw form -update control { - &Tmp-Octets-0 := 0x686970706f # Hippo - &Tmp-Octets-0 += 0x0a # new line - &Tmp-Octets-0 += 0x626c6970706f # Blippo +&control += { + &Tmp-Octets-0 = 0x686970706f # Hippo + &Tmp-Octets-0 = 0x0a # new line + &Tmp-Octets-0 = 0x626c6970706f # Blippo } -update control { - &Tmp-String-0 := 'test_multi_octets' -} +&control.Tmp-String-0 := 'test_multi_octets' + linelog_ref_multi -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` -} + +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` if (&Tmp-String-0 == ', blippo, ') { test_pass @@ -72,9 +62,8 @@ else { } # When no attributes that match are available, linelog should return noop -update control { - &Tmp-String-0 := 'test_empty' -} +&control.Tmp-String-0 := 'test_empty' + linelog_ref_multi if (noop) { test_pass @@ -84,6 +73,4 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_multi.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_multi.log"` diff --git a/src/tests/modules/linelog/linelog.unlang b/src/tests/modules/linelog/linelog.unlang index 1b97e790686..1dfe9820558 100644 --- a/src/tests/modules/linelog/linelog.unlang +++ b/src/tests/modules/linelog/linelog.unlang @@ -1,14 +1,10 @@ -update control { - &Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' -} +&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"' # # Remove old log files # group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_a.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_a.log"` actions { fail = 1 @@ -19,13 +15,10 @@ if (fail) { } # Check linelog fails over to the default message (an xlat expansion) -update control { - &Tmp-String-0 := 'test_default' -} +&control.Tmp-String-0 := 'test_default' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == 'bob default') { test_pass @@ -35,14 +28,11 @@ else { } # Check linelog adds a newline at the end of each message (also tests if execs pointed to by refs work) -update control { - &Tmp-String-0 := 'test_exec' -} +&control.Tmp-String-0 := 'test_exec' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == 'bob exec') { test_pass @@ -52,9 +42,7 @@ else { } # Check it's not overwriting the same line repeatedly -update request { - &Tmp-String-0 := `/bin/sh -c "head -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "head -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == 'bob default') { test_pass @@ -64,14 +52,11 @@ else { } # Check linelog can use attrs pointed to by refs -update control { - &Tmp-String-0 := 'test_attr' -} +&control.Tmp-String-0 := 'test_attr' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == 'bob') { test_pass @@ -81,14 +66,11 @@ else { } # Check linelog can use xlats pointed to by refs -update control { - &Tmp-String-0 := 'test_xlat' -} +&control.Tmp-String-0 := 'test_xlat' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -98,14 +80,11 @@ else { } # Check linelog can use literals pointed to by refs -update control { - &Tmp-String-0 := 'test_literal' -} +&control.Tmp-String-0 := 'test_literal' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == '%{User-Name} literal') { test_pass @@ -115,14 +94,11 @@ else { } # Check linelog can use empty conf pairs -update control { - &Tmp-String-0 := 'test_empty' -} +&control.Tmp-String-0 := 'test_empty' + linelog_fmt_and_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` if (&Tmp-String-0 == '') { test_pass @@ -132,15 +108,11 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_a.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_a.log"` # Remove old log files group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_b.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_b.log"` actions { fail = 1 @@ -151,9 +123,8 @@ if (fail) { } # Check behaviour when we don't have a default configured (should not create new file) -update control { - &Tmp-String-0 := 'test_default' -} +&control.Tmp-String-0 := 'test_default' + linelog_ref if (noop) { test_pass @@ -163,9 +134,7 @@ else { } group { - update request { - &Tmp-String-0 := `/bin/sh -c "test ! -e $ENV{MODULE_TEST_DIR}/test_b.log"` - } + &Tmp-String-0 := `/bin/sh -c "test ! -e $ENV{MODULE_TEST_DIR}/test_b.log"` actions { fail = 1 @@ -179,14 +148,11 @@ else { } # Check ref still works (with an exec) -update control { - &Tmp-String-0 := 'test_exec' -} +&control.Tmp-String-0 := 'test_exec' + linelog_ref -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_b.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_b.log"` if (&Tmp-String-0 == 'bob exec') { test_pass @@ -196,15 +162,11 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_b.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_b.log"` # Remove old log files group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_c.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_c.log"` actions { fail = 1 @@ -215,14 +177,10 @@ if (fail) { } # Check behaviour using an attribute ref as a path -update control { - &Tmp-String-0 := '.messages.test_xlat' -} +&control.Tmp-String-0 := '.messages.test_xlat' linelog_fmt_and_ref_attr -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -232,14 +190,10 @@ else { } # Check behaviour using an attribute ref (non existent path, with default also an attribute ref) -update control { - &Tmp-String-0 := 'test_xlat' -} +&control.Tmp-String-0 := 'test_xlat' linelog_fmt_and_ref_attr -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` if (&Tmp-String-0 == 'bob') { test_pass @@ -249,14 +203,10 @@ else { } # Check '.' is always prefixed to the path -update control { - &Tmp-String-0 := 'messages.test_xlat' -} +&control.Tmp-String-0 := 'messages.test_xlat' linelog_fmt_and_ref_attr -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -266,9 +216,7 @@ else { } # Check '..' results in a 'fail' (can't go up one level) -update control { - &Tmp-String-0 := '..messages.test_attr' -} +&control.Tmp-String-0 := '..messages.test_attr' linelog_fmt_and_ref_attr { fail = 1 @@ -280,9 +228,7 @@ else { test_fail } -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -292,9 +238,7 @@ else { } # Check '.messages' results in a 'fail' (messages is a section) -update control { - &Tmp-String-0 := '.messages' -} +&control.Tmp-String-0 := '.messages' linelog_fmt_and_ref_attr { fail = 1 @@ -307,15 +251,11 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_c.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_c.log"` # Remove old log files group { - update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_d.log"` - } + &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_d.log"` actions { fail = 1 @@ -326,9 +266,8 @@ if (fail) { } linelog_fmt -update request { - &Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_d.log"` -} +&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_d.log"` + if (&Tmp-String-0 == 'bob') { test_pass } @@ -337,6 +276,4 @@ else { } # Remove the file -update request { - &Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_d.log"` -} +&Tmp-String-0 := `/bin/sh -c "rm $ENV{MODULE_TEST_DIR}/test_d.log"` diff --git a/src/tests/modules/lua/mod2.lua b/src/tests/modules/lua/mod2.lua index 8abfa41b3ea..4b169c6277b 100644 --- a/src/tests/modules/lua/mod2.lua +++ b/src/tests/modules/lua/mod2.lua @@ -10,7 +10,7 @@ function authorize() end if not type(fr.request) == "table" then - print("error: The 'fr.request.{}' should be table") + print("error: The 'fr.{}' should be table") return fr.rcode.fail end diff --git a/src/tests/modules/lua/mod3.lua b/src/tests/modules/lua/mod3.lua index dc517f9d60b..af144871327 100644 --- a/src/tests/modules/lua/mod3.lua +++ b/src/tests/modules/lua/mod3.lua @@ -1,5 +1,5 @@ function authorize() - for k, v in fr.request.pairs() do + for k, v in fr.pairs() do if k == "Framed-IPv6-Prefix" and v == "11:22:33:44:55:66:77:88/128" then return fr.rcode.ok end diff --git a/src/tests/modules/lua/mod4.lua b/src/tests/modules/lua/mod4.lua index be7c807313b..e2648213d3f 100644 --- a/src/tests/modules/lua/mod4.lua +++ b/src/tests/modules/lua/mod4.lua @@ -1,5 +1,5 @@ function authorize() - for k, v in fr.request.pairs() do + for k, v in fr.pairs() do if k == "User-Name" and v == "caipirinha" then return fr.rcode.ok end diff --git a/src/tests/modules/lua/mod8.lua b/src/tests/modules/lua/mod8.lua index 5fee003b1d0..e3614743c5c 100644 --- a/src/tests/modules/lua/mod8.lua +++ b/src/tests/modules/lua/mod8.lua @@ -33,10 +33,10 @@ function authorize() fr.log.debug("Powered by Luajit+FFI & fr_log()") -- fr.request {} - print("# fr.request.{}") + print("# fr.{}") print("type(fr.request) = " .. type(fr.request)) - print("for k,v in fr.request.pairs()") - for k,v in fr.request.pairs() do print("\t"..k, v) end + print("for k,v in fr.pairs()") + for k,v in fr.pairs() do print("\t"..k, v) end print() print("#mod8.lua: returning fr.rcode.noop") diff --git a/src/tests/modules/pap/bin_random.unlang b/src/tests/modules/pap/bin_random.unlang index b37b9750263..b03376793f0 100644 --- a/src/tests/modules/pap/bin_random.unlang +++ b/src/tests/modules/pap/bin_random.unlang @@ -1,10 +1,7 @@ if (&User-Name == 'test') { - update request { - &User-Password := "%{randstr:bbbbbbbbbbbbbbbb}" - } - update control { - &Password.Cleartext := "%{User-Password}" - } + &User-Password := "%{randstr:bbbbbbbbbbbbbbbb}" + &control.Password.Cleartext := "%{User-Password}" + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_dig_big.unlang b/src/tests/modules/pap/pbkfd2_dig_big.unlang index 76325d1e511..b9a00e2b887 100644 --- a/src/tests/modules/pap/pbkfd2_dig_big.unlang +++ b/src/tests/modules/pap/pbkfd2_dig_big.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_dig_big') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_dig_small.unlang b/src/tests/modules/pap/pbkfd2_dig_small.unlang index b9a9c4f0a28..78a40c45176 100644 --- a/src/tests/modules/pap/pbkfd2_dig_small.unlang +++ b/src/tests/modules/pap/pbkfd2_dig_small.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_dig_small') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter0.unlang b/src/tests/modules/pap/pbkfd2_iter0.unlang index 773fd0a3f64..d8f7d37563d 100644 --- a/src/tests/modules/pap/pbkfd2_iter0.unlang +++ b/src/tests/modules/pap/pbkfd2_iter0.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter0') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAP:CuNDJ9NimZoP5ljnPNCBUA==:f09zV7dReGg5SIv/EXY9tCL4XQRr5guhL0Q6UXSKI3c=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAP:CuNDJ9NimZoP5ljnPNCBUA==:f09zV7dReGg5SIv/EXY9tCL4XQRr5guhL0Q6UXSKI3c=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter1.unlang b/src/tests/modules/pap/pbkfd2_iter1.unlang index ec048cbd541..62e10555682 100644 --- a/src/tests/modules/pap/pbkfd2_iter1.unlang +++ b/src/tests/modules/pap/pbkfd2_iter1.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter1') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:OErtptMl2hOxhQqvNw7sNw==:4KkrgL+3Q9j8KlHPivtApBKRZAjyWjtDWmZEz2UjNko=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:OErtptMl2hOxhQqvNw7sNw==:4KkrgL+3Q9j8KlHPivtApBKRZAjyWjtDWmZEz2UjNko=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter1000.unlang b/src/tests/modules/pap/pbkfd2_iter1000.unlang index 69b68b63f5a..d0a8ece9f49 100644 --- a/src/tests/modules/pap/pbkfd2_iter1000.unlang +++ b/src/tests/modules/pap/pbkfd2_iter1000.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter1000') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAD6A:yhmqoKrtPLY2KYK6cNjnfw==:Y6gkSZEo4TRtlsryHqnGYZhoe2qn5tJ4IUyyVHb/3WU=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAD6A:yhmqoKrtPLY2KYK6cNjnfw==:Y6gkSZEo4TRtlsryHqnGYZhoe2qn5tJ4IUyyVHb/3WU=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter100000.unlang b/src/tests/modules/pap/pbkfd2_iter100000.unlang index d1f22bf682f..a01bde046ec 100644 --- a/src/tests/modules/pap/pbkfd2_iter100000.unlang +++ b/src/tests/modules/pap/pbkfd2_iter100000.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter100000') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AA9CQA:fCfnJGMVC1QLtTOPiaSICA==:KCmjMpQ+lokMvyFTl4f4pPJNc0xJq4iHZPdtHa0OEXM=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AA9CQA:fCfnJGMVC1QLtTOPiaSICA==:KCmjMpQ+lokMvyFTl4f4pPJNc0xJq4iHZPdtHa0OEXM=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter_big.unlang b/src/tests/modules/pap/pbkfd2_iter_big.unlang index 634a6d812dc..c3f936206a9 100644 --- a/src/tests/modules/pap/pbkfd2_iter_big.unlang +++ b/src/tests/modules/pap/pbkfd2_iter_big.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter_big') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ==:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ==:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_iter_miss.unlang b/src/tests/modules/pap/pbkfd2_iter_miss.unlang index b459a0ed07d..375d8ab6f5f 100644 --- a/src/tests/modules/pap/pbkfd2_iter_miss.unlang +++ b/src/tests/modules/pap/pbkfd2_iter_miss.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter_miss') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256::E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256::E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' + pap.authorize pap.authenticate { invalid = 1 diff --git a/src/tests/modules/pap/pbkfd2_iter_small.unlang b/src/tests/modules/pap/pbkfd2_iter_small.unlang index b35f7fb0c09..50353f894ab 100644 --- a/src/tests/modules/pap/pbkfd2_iter_small.unlang +++ b/src/tests/modules/pap/pbkfd2_iter_small.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_iter_small') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAA:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAA:E+VXOSsE8RwyYGdygQoW9Q==:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' + pap.authorize pap.authenticate { invalid = 1 diff --git a/src/tests/modules/pap/pbkfd2_passlib.unlang b/src/tests/modules/pap/pbkfd2_passlib.unlang index cc84f656cd5..c4dd47ccecb 100644 --- a/src/tests/modules/pap/pbkfd2_passlib.unlang +++ b/src/tests/modules/pap/pbkfd2_passlib.unlang @@ -7,9 +7,7 @@ test_pass #} #if (&User-Name == 'pbkdf2_passlib') { -# update control { -# &Password.PBKDF2 := '$pbkdf2-sha256$29000$9t7be09prfXee2/NOUeotQ$Y.RDnnq8vsezSZSKy1QNy6xhKPdoBIwc.0XDdRm9sJ8' -# } +# &control.Password.PBKDF2 := '$pbkdf2-sha256$29000$9t7be09prfXee2/NOUeotQ$Y.RDnnq8vsezSZSKy1QNy6xhKPdoBIwc.0XDdRm9sJ8' # pap.authorize # pap.authenticate # if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_salt0.unlang b/src/tests/modules/pap/pbkfd2_salt0.unlang index 5aa60ab4313..443f467cc33 100644 --- a/src/tests/modules/pap/pbkfd2_salt0.unlang +++ b/src/tests/modules/pap/pbkfd2_salt0.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt0') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAnEA::4RJEKVFQ5nE8126aURI0cJO9tqy/DIAhq64piBEwshA=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAnEA::4RJEKVFQ5nE8126aURI0cJO9tqy/DIAhq64piBEwshA=' + pap.authorize pap.authenticate { invalid = 1 diff --git a/src/tests/modules/pap/pbkfd2_salt1.unlang b/src/tests/modules/pap/pbkfd2_salt1.unlang index 9c9e8c8ffce..12aeca446e4 100644 --- a/src/tests/modules/pap/pbkfd2_salt1.unlang +++ b/src/tests/modules/pap/pbkfd2_salt1.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt1') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:qg==:KQzCdedgOZYFwx+mQp1TKA8VM4fwf02pqSdJEh2ekwM=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:qg==:KQzCdedgOZYFwx+mQp1TKA8VM4fwf02pqSdJEh2ekwM=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_salt1024.unlang b/src/tests/modules/pap/pbkfd2_salt1024.unlang index 4c90087e2fe..ec05a5350d2 100644 --- a/src/tests/modules/pap/pbkfd2_salt1024.unlang +++ b/src/tests/modules/pap/pbkfd2_salt1024.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt1024') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:/IUrkJKe+1kzJNBw7aAMbnQuSFZpjbCqPeKso3cbuSUzWinxngxjK8yyZLiWwF+WE/0Gplfx25zZEQNTdRTvjZZNefoxQBR8Hht0FpdU9YiEBaeErwVo63EDEu83+ycvB18uH0IXpJKGSSkIPRfGpHT3BkwJDGo5SqjRJadDsyQzkc/WJCMrrfJ0igaWMxb5eR5J8qfXIjBFepRrOOU6acZGtANW8qvDYLJwN+TMd9Jb1wDDY14eoAlKglTF21S3kewNMkDDyeP+oDYv29t1S/soFUnnB+Pb5IdR6pDy2VDGx4jFZMQGshSHWTYQFqgulavS/tGEF8TvzcorrJZKuksAjKdTSmfZ6j4aBY3U+oMSQ+2lO131pkNfNQuMsDfr72r9wUA2xRgUiL/J7CgKn7mamL2OCaksl0Rw2PGqqIaHvAYS6Q1EoIzsmLNrWBYYqTRLyCGZw6+hUOahYRon2lglGmnuWHPfowU+LgcaR5gF1QjvTXhXQ8I39mB3ePgdi+7TUn644Z1FB+JTqGJbue92x4V40Zyyy+Qdt52QsR49iYokbKAwQRiqfVJ7J8NzCY/kIQnqT9RE0NCxZoMBRzboZxVPchxdpmWGQ9dXP06PqIuDCFFiJlVQUfyPMgOAxIlVJ/9NAmj5MWFdWMrmlBNDx9ihEV1FdTv23iFZH5Ejg+x4D3qN5oOyCDL2i9lobzFXh5z4EDpbbogQaFkUzqKEaxRGPBrfYVOi6XXYujVUnxHJaRxbs2UqjpJNsXMg8f7P78aRvOKCIbW70CHWlt7nF0pA5+kFUQRLXKuq7bW+ivoXKeDW5o4FVP3+Pcr67+DOsUXuehALLj9Mu2ICWlMIV/AWcM2szaqk1bwSo7bAeG4RtDKmNjGA7gpnT+w2x+/qS1eWbc832Sumqc1IA8aY6HNVDPsJZf99To4BR+N0rCoQQ/KIZybI31mQagR3+FR9yNzqWzKIl+qf69RTc1CbUCkKVF8pxWZ0ocP+CAdoKadgpdF8evQIiGcUD73HiJ0RsDWo21y0tN0P5jfzWo3WMhCk9e2wl6o1JAfKw54uHzWJnNlGLBK1LXF+R2m+WvNGBgvUhh4PtYV9gPSudumFdk614oak/Aqcn6xi+YZqOMPkW4WYaiczhHyS7qAyefqKaQkRVYS0Af+79CSjlxZJq57HrD7/1E+d/i0gKmSAbPe80uGHs2a13V3VxztFMBi4xD7zj9Mq7+0goVPD4MNXcR651MZ7vxDRGbvPPmclddZe/nkTEn1YB/909b9mC5P/XzximZYW8gEhBReZouukADRTAjuH8zgSIv6/uyTURnmSVoOumVLBpL7veJIzDm4dZ38BWiasiBnzgMuG9A==:RUoCF5O11OgwLFMTqnKY/yRJy6DYh+yNq4xHZC7COGM=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:/IUrkJKe+1kzJNBw7aAMbnQuSFZpjbCqPeKso3cbuSUzWinxngxjK8yyZLiWwF+WE/0Gplfx25zZEQNTdRTvjZZNefoxQBR8Hht0FpdU9YiEBaeErwVo63EDEu83+ycvB18uH0IXpJKGSSkIPRfGpHT3BkwJDGo5SqjRJadDsyQzkc/WJCMrrfJ0igaWMxb5eR5J8qfXIjBFepRrOOU6acZGtANW8qvDYLJwN+TMd9Jb1wDDY14eoAlKglTF21S3kewNMkDDyeP+oDYv29t1S/soFUnnB+Pb5IdR6pDy2VDGx4jFZMQGshSHWTYQFqgulavS/tGEF8TvzcorrJZKuksAjKdTSmfZ6j4aBY3U+oMSQ+2lO131pkNfNQuMsDfr72r9wUA2xRgUiL/J7CgKn7mamL2OCaksl0Rw2PGqqIaHvAYS6Q1EoIzsmLNrWBYYqTRLyCGZw6+hUOahYRon2lglGmnuWHPfowU+LgcaR5gF1QjvTXhXQ8I39mB3ePgdi+7TUn644Z1FB+JTqGJbue92x4V40Zyyy+Qdt52QsR49iYokbKAwQRiqfVJ7J8NzCY/kIQnqT9RE0NCxZoMBRzboZxVPchxdpmWGQ9dXP06PqIuDCFFiJlVQUfyPMgOAxIlVJ/9NAmj5MWFdWMrmlBNDx9ihEV1FdTv23iFZH5Ejg+x4D3qN5oOyCDL2i9lobzFXh5z4EDpbbogQaFkUzqKEaxRGPBrfYVOi6XXYujVUnxHJaRxbs2UqjpJNsXMg8f7P78aRvOKCIbW70CHWlt7nF0pA5+kFUQRLXKuq7bW+ivoXKeDW5o4FVP3+Pcr67+DOsUXuehALLj9Mu2ICWlMIV/AWcM2szaqk1bwSo7bAeG4RtDKmNjGA7gpnT+w2x+/qS1eWbc832Sumqc1IA8aY6HNVDPsJZf99To4BR+N0rCoQQ/KIZybI31mQagR3+FR9yNzqWzKIl+qf69RTc1CbUCkKVF8pxWZ0ocP+CAdoKadgpdF8evQIiGcUD73HiJ0RsDWo21y0tN0P5jfzWo3WMhCk9e2wl6o1JAfKw54uHzWJnNlGLBK1LXF+R2m+WvNGBgvUhh4PtYV9gPSudumFdk614oak/Aqcn6xi+YZqOMPkW4WYaiczhHyS7qAyefqKaQkRVYS0Af+79CSjlxZJq57HrD7/1E+d/i0gKmSAbPe80uGHs2a13V3VxztFMBi4xD7zj9Mq7+0goVPD4MNXcR651MZ7vxDRGbvPPmclddZe/nkTEn1YB/909b9mC5P/XzximZYW8gEhBReZouukADRTAjuH8zgSIv6/uyTURnmSVoOumVLBpL7veJIzDm4dZ38BWiasiBnzgMuG9A==:RUoCF5O11OgwLFMTqnKY/yRJy6DYh+yNq4xHZC7COGM=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_salt64.unlang b/src/tests/modules/pap/pbkfd2_salt64.unlang index 981d7aa8beb..7ee75ffd5da 100644 --- a/src/tests/modules/pap/pbkfd2_salt64.unlang +++ b/src/tests/modules/pap/pbkfd2_salt64.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt64') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:msGxE1XuC+wlgRr+H4+ioyxZuiN3KYLUSky2FINDTq7KJylKt4XnqloV+FuHGXUbOu1EWcsFp51u2z8wdXVnQQ==:rAV9BeEJH5kt9uZ6pJt0o5pYpN5LQRe4MAYyk2jvjpU=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:msGxE1XuC+wlgRr+H4+ioyxZuiN3KYLUSky2FINDTq7KJylKt4XnqloV+FuHGXUbOu1EWcsFp51u2z8wdXVnQQ==:rAV9BeEJH5kt9uZ6pJt0o5pYpN5LQRe4MAYyk2jvjpU=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_salt_big.unlang b/src/tests/modules/pap/pbkfd2_salt_big.unlang index 7707dabbc50..d2456ea588e 100644 --- a/src/tests/modules/pap/pbkfd2_salt_big.unlang +++ b/src/tests/modules/pap/pbkfd2_salt_big.unlang @@ -4,9 +4,7 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt_big') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9QA==:pF23EcxNBhJLQ+9JRtd9wQ1Gz+k4i6YjeNZq+7DRBX8=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9QA==:pF23EcxNBhJLQ+9JRtd9wQ1Gz+k4i6YjeNZq+7DRBX8=' pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_salt_small.unlang b/src/tests/modules/pap/pbkfd2_salt_small.unlang index a7d1d0eba83..2872decf0a6 100644 --- a/src/tests/modules/pap/pbkfd2_salt_small.unlang +++ b/src/tests/modules/pap/pbkfd2_salt_small.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_salt_small') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q=:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAAAQ:E+VXOSsE8RwyYGdygQoW9Q=:UivlvrwHML4VtZHMJLiT/xlH7oyoyvbXQceivptq9TI=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_sha1.unlang b/src/tests/modules/pap/pbkfd2_sha1.unlang index 819d043e170..84aa363981c 100644 --- a/src/tests/modules/pap/pbkfd2_sha1.unlang +++ b/src/tests/modules/pap/pbkfd2_sha1.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_sha1') { - update control { - &Password.PBKDF2 := 'HMACSHA1:AAAD6A:Xw1P133xrwk=:dtQBXQRiR/No5A8Ip3JFGF/qUC0=' - } + &control.Password.PBKDF2 := 'HMACSHA1:AAAD6A:Xw1P133xrwk=:dtQBXQRiR/No5A8Ip3JFGF/qUC0=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_sha2_224.unlang b/src/tests/modules/pap/pbkfd2_sha2_224.unlang index acd79ad2e83..c0403ca2823 100644 --- a/src/tests/modules/pap/pbkfd2_sha2_224.unlang +++ b/src/tests/modules/pap/pbkfd2_sha2_224.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_sha2_224') { - update control { - &Password.PBKDF2 := 'HMACSHA2+224:AAAnEA:UHScBrg/ZWOyBKqQdAh7bw==:tcFp6CDrkIYdhwa60g24U4ko+mBxzAiFxlpPnA==' - } + &control.Password.PBKDF2 := 'HMACSHA2+224:AAAnEA:UHScBrg/ZWOyBKqQdAh7bw==:tcFp6CDrkIYdhwa60g24U4ko+mBxzAiFxlpPnA==' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_sha2_256.unlang b/src/tests/modules/pap/pbkfd2_sha2_256.unlang index 18085fe7029..69c1659c110 100644 --- a/src/tests/modules/pap/pbkfd2_sha2_256.unlang +++ b/src/tests/modules/pap/pbkfd2_sha2_256.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_sha2_256') { - update control { - &Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:a/8HbYW2HWsMthN27JI+Ew==:3nPlXYOlOuDCFOfethUomHxTXkG9JCivOdvh6FDNdGw=' - } + &control.Password.PBKDF2 := 'HMACSHA2+256:AAAnEA:a/8HbYW2HWsMthN27JI+Ew==:3nPlXYOlOuDCFOfethUomHxTXkG9JCivOdvh6FDNdGw=' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_sha2_384.unlang b/src/tests/modules/pap/pbkfd2_sha2_384.unlang index 1c4d1ef260a..9fb8e396eaf 100644 --- a/src/tests/modules/pap/pbkfd2_sha2_384.unlang +++ b/src/tests/modules/pap/pbkfd2_sha2_384.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_sha2_384') { - update control { - &Password.PBKDF2 := 'HMACSHA2+384:AAAnEA:pyHRsYLfNZdjszRcu6eHrA==:ktGfNmZ6PyD8FNEgPzFK1fypKERZ13pgvFl+PQdyKouaMXsXIiWPuTMXHqDUCWsx' - } + &control.Password.PBKDF2 := 'HMACSHA2+384:AAAnEA:pyHRsYLfNZdjszRcu6eHrA==:ktGfNmZ6PyD8FNEgPzFK1fypKERZ13pgvFl+PQdyKouaMXsXIiWPuTMXHqDUCWsx' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/pbkfd2_sha2_512.unlang b/src/tests/modules/pap/pbkfd2_sha2_512.unlang index fc8f4a68195..85289e036b1 100644 --- a/src/tests/modules/pap/pbkfd2_sha2_512.unlang +++ b/src/tests/modules/pap/pbkfd2_sha2_512.unlang @@ -4,9 +4,8 @@ if ("${feature.tls}" == no) { } if (&User-Name == 'pbkdf2_sha2_512') { - update control { - &Password.PBKDF2 := 'HMACSHA2+512:AAAnEA:TG8Mb94NEmfPLaePwi5CFA==:SYSFeRf9jr4Uo5DB4NvNUEuc1gmEiLjTac5J4WgyKa7mO58KHKWop9xWmcFeuLtUN/iexLTNSgcubOugAyZcog==' - } + &control.Password.PBKDF2 := 'HMACSHA2+512:AAAnEA:TG8Mb94NEmfPLaePwi5CFA==:SYSFeRf9jr4Uo5DB4NvNUEuc1gmEiLjTac5J4WgyKa7mO58KHKWop9xWmcFeuLtUN/iexLTNSgcubOugAyZcog==' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/plaintext_with_dollar_0.unlang b/src/tests/modules/pap/plaintext_with_dollar_0.unlang index 54257f833af..edbeb9f1823 100644 --- a/src/tests/modules/pap/plaintext_with_dollar_0.unlang +++ b/src/tests/modules/pap/plaintext_with_dollar_0.unlang @@ -1,7 +1,5 @@ if (&User-Name == 'plaintext_with_dollar_0') { - update control { - &Password.Cleartext := 'password$' - } + &control.Password.Cleartext := 'password$' pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/plaintext_with_dollar_1.unlang b/src/tests/modules/pap/plaintext_with_dollar_1.unlang index 0eacc8ae55a..6bfd882555d 100644 --- a/src/tests/modules/pap/plaintext_with_dollar_1.unlang +++ b/src/tests/modules/pap/plaintext_with_dollar_1.unlang @@ -1,7 +1,6 @@ if (&User-Name == 'plaintext_with_dollar_1') { - update control { - &Password.Cleartext := '$password' - } + &control.Password.Cleartext := '$password' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/plaintext_with_dollar_2.unlang b/src/tests/modules/pap/plaintext_with_dollar_2.unlang index e4eec711fca..2989671d602 100644 --- a/src/tests/modules/pap/plaintext_with_dollar_2.unlang +++ b/src/tests/modules/pap/plaintext_with_dollar_2.unlang @@ -1,7 +1,6 @@ if (&User-Name == 'plaintext_with_dollar_2') { - update control { - &Password.Cleartext := 'pass$word' - } + &control.Password.Cleartext := 'pass$word' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/pap/plaintext_with_dollar_3.unlang b/src/tests/modules/pap/plaintext_with_dollar_3.unlang index cf13d5a8aac..0180251dcf0 100644 --- a/src/tests/modules/pap/plaintext_with_dollar_3.unlang +++ b/src/tests/modules/pap/plaintext_with_dollar_3.unlang @@ -1,7 +1,6 @@ if (&User-Name == 'plaintext_with_dollar_3') { - update control { - &Password.Cleartext := '$pass$word' - } + &control.Password.Cleartext := '$pass$word' + pap.authorize pap.authenticate if (!ok) { diff --git a/src/tests/modules/perl/auth.unlang b/src/tests/modules/perl/auth.unlang index 1a144daf9ee..69f742549b7 100644 --- a/src/tests/modules/perl/auth.unlang +++ b/src/tests/modules/perl/auth.unlang @@ -10,14 +10,10 @@ if (&reply.Reply-Message != "Denied access by rlm_perl function") { test_fail } -update reply { - &Reply-Message !* ANY -} +&reply -= &Reply-Message[*] # User will not be rejected - an xlat will be called setting a reply attribute -update request { - &User-Name := 'bob' -} +&User-Name := 'bob' perl.authenticate diff --git a/src/tests/modules/perl/xlat.unlang b/src/tests/modules/perl/xlat.unlang index d5045ea9bf3..4dbeb32a92b 100644 --- a/src/tests/modules/perl/xlat.unlang +++ b/src/tests/modules/perl/xlat.unlang @@ -7,87 +7,66 @@ # once multiple retuned boxes are handled to produce multiple attributes the tests # will need amending. -update request { - &Tmp-String-0 := "hello,goodbye,welcome,farewell" - &Tmp-String-1 := "foo,bar" -} -update request{ - &Tmp-String-2 := "%(perl_xlat:xlat %{Tmp-String-0})" -} +&Tmp-String-0 := "hello,goodbye,welcome,farewell" +&Tmp-String-1 := "foo,bar" +&Tmp-String-2 := "%(perl_xlat:xlat %{Tmp-String-0})" if (&Tmp-String-2 != "hello|goodbye|welcome|farewell") { test_fail } # Check for multiple arguments to perl function -update request { - &Tmp-String-3 := "%(perl_xlat:xlat %{Tmp-String-0} %{Tmp-String-1})" -} +&Tmp-String-3 := "%(perl_xlat:xlat %{Tmp-String-0} %{Tmp-String-1})" if (&Tmp-String-3 != "hello|goodbye|welcome|farewell#foo|bar") { test_fail } -update request { - &Tmp-Integer-0 := "%(perl_xlat:add 1 2 3)" -} +&Tmp-Integer-0 := "%(perl_xlat:add 1 2 3)" if (&Tmp-Integer-0 != 6) { test_fail } - -update request { - &Tmp-String-0 := "hello" - &Tmp-String-0 += "goodbye" - &Tmp-String-0 += "welcome" +&Tmp-String-0 := "hello" +&request += { + &Tmp-String-0 = "goodbye" + &Tmp-String-0 = "welcome" } # Pass a list as an array -update request { - &Tmp-String-2 := "%(perl_xlat:xlatarray %{Tmp-String-0[*]})" -} +&Tmp-String-2 := "%(perl_xlat:xlatarray %{Tmp-String-0[*]})" if (&Tmp-String-2 != "hello|goodbye|welcome") { test_fail } -update request { - &Tmp-String-0 := "aa bb cc dd ee" -} +&Tmp-String-0 := "aa bb cc dd ee" # Expect an array of returned values -update request { - &Tmp-String-2 := "%(perl_xlat:xlatscalar2array %{Tmp-String-0})" -} +&Tmp-String-2 := "%(perl_xlat:xlatscalar2array %{Tmp-String-0})" if (&Tmp-String-2 != "aabbccddee") { test_fail } -update request { - &Tmp-String-1 := "ff gg hh ii" -} +&Tmp-String-1 := "ff gg hh ii" # Expect an array of array ref returned values -update request { - &Tmp-String-2 := "%(perl_xlat:xlatscalar2arrayref %{Tmp-String-0} %{Tmp-String-1})" -} +&Tmp-String-2 := "%(perl_xlat:xlatscalar2arrayref %{Tmp-String-0} %{Tmp-String-1})" if (&Tmp-String-2 != "aabbccddeeffgghhii") { test_fail } -update request { - &Tmp-String-0 := "a" - &Tmp-String-0 += "b" - &Tmp-String-0 += "c" +&Tmp-String-0 := "a" +&request += { + &Tmp-String-0 = "b" + &Tmp-String-0 = "c" } # Returns a hash with each element in the provided array converted to Vn->value -update request { - &Tmp-String-2 := "%(perl_xlat:xlatarray2hash %{Tmp-String-0[*]})" -} +&Tmp-String-2 := "%(perl_xlat:xlatarray2hash %{Tmp-String-0[*]})" # Note: hashes don't have a defined sequence so these are all the possible return values if (&Tmp-String-2 != "V1aV2bV3c") && (&Tmp-String-2 != "V1aV3cV2b") && (&Tmp-String-2 != "V2bV1aV3c") && (&Tmp-String-2 != "V2bV3cV1a") && (&Tmp-String-2 != "V3cV1aV2b") && (&Tmp-String-2 != "V3cV2bV1a") { diff --git a/src/tests/modules/redis/cluster_key.unlang b/src/tests/modules/redis/cluster_key.unlang index 9ef6c0907d5..5a622a25cb5 100644 --- a/src/tests/modules/redis/cluster_key.unlang +++ b/src/tests/modules/redis/cluster_key.unlang @@ -10,11 +10,9 @@ $INCLUDE cluster_reset.inc # - 127.0.0.1:30005 - slave # - 127.0.0.1:30003 - master [10923-16383] # - 127.0.0.1:30006 - slave -update control { - &Tmp-String-0 := "1-%{randstr:aaaaaaaa}" - &Tmp-String-1 := "2-%{randstr:aaaaaaaa}" - &Tmp-String-2 := "3-%{randstr:aaaaaaaa}" -} +&control.Tmp-String-0 := "1-%{randstr:aaaaaaaa}" +&control.Tmp-String-1 := "2-%{randstr:aaaaaaaa}" +&control.Tmp-String-2 := "3-%{randstr:aaaaaaaa}" # Hashes to Redis cluster node master 1 (1) if ("%(redis:SET b "%{control.Tmp-String-0}")" == 'OK') { diff --git a/src/tests/modules/redis/cluster_node_fail.unlang b/src/tests/modules/redis/cluster_node_fail.unlang index 56cdc9949f2..1d8b0b2e981 100644 --- a/src/tests/modules/redis/cluster_node_fail.unlang +++ b/src/tests/modules/redis/cluster_node_fail.unlang @@ -11,9 +11,7 @@ if ("%(redis:SET b 'boom')" == 'OK') { } # Leave some time (100ms) for the synchronisation -update request { - &Tmp-String-0 := `/bin/sleep 0.1` -} +&Tmp-String-0 := `/bin/sleep 0.1` # Cause one of the redis cluster nodes to SEGV if ("%(redis:@%(redis_node:b 0) DEBUG SEGFAULT)" != '') { diff --git a/src/tests/modules/redis/cluster_reset.inc b/src/tests/modules/redis/cluster_reset.inc index 63bb51a3c75..0a063bdcbce 100644 --- a/src/tests/modules/redis/cluster_reset.inc +++ b/src/tests/modules/redis/cluster_reset.inc @@ -3,53 +3,45 @@ # # Some values we need for startup -update control { - &Tmp-Integer-0 := 0 - &Tmp-Integer-0 += 1 - &Tmp-Integer-0 += 2 - &Tmp-Integer-0 += 3 - &Tmp-Integer-0 += 4 - &Tmp-Integer-0 += 5 - &Tmp-Integer-0 += 6 - &Tmp-Integer-0 += 7 - &Tmp-Integer-0 += 8 - &Tmp-Integer-0 += 9 - &Tmp-Integer-0 += 10 - &Tmp-String-0 := "1-%{randstr:aaaaaaaa}" - &Tmp-String-1 := "2-%{randstr:aaaaaaaa}" - &Tmp-String-2 := "3-%{randstr:aaaaaaaa}" +&control += { + &Tmp-Integer-0 = 0 + &Tmp-Integer-0 = 1 + &Tmp-Integer-0 = 2 + &Tmp-Integer-0 = 3 + &Tmp-Integer-0 = 4 + &Tmp-Integer-0 = 5 + &Tmp-Integer-0 = 6 + &Tmp-Integer-0 = 7 + &Tmp-Integer-0 = 8 + &Tmp-Integer-0 = 9 + &Tmp-Integer-0 = 10 } +&control.Tmp-String-0 := "1-%{randstr:aaaaaaaa}" +&control.Tmp-String-1 := "2-%{randstr:aaaaaaaa}" +&control.Tmp-String-2 := "3-%{randstr:aaaaaaaa}" + if ("$ENV{REDIS_CLUSTER_CONTROL}" == '') { - update control { - &Tmp-String-8 := 'scripts/ci/redis-setup.sh' - } + &control.Tmp-String-8 := 'scripts/ci/redis-setup.sh' } else { - update control { - &Tmp-String-8 := "$ENV{REDIS_CLUSTER_CONTROL}" - } + &control.Tmp-String-8 := "$ENV{REDIS_CLUSTER_CONTROL}" } # # Reset the cluster # -update control { - &Tmp-String-0 = `%{control.Tmp-String-8} stop` - &Tmp-String-0 = `%{control.Tmp-String-8} clean` - &Tmp-String-0 = `%{control.Tmp-String-8} start` - &Tmp-String-0 = `%{control.Tmp-String-8} create` -} +&control.Tmp-String-0 := `%{control.Tmp-String-8} stop` +&control.Tmp-String-0 := `%{control.Tmp-String-8} clean` +&control.Tmp-String-0 := `%{control.Tmp-String-8} start` +&control.Tmp-String-0 := `%{control.Tmp-String-8} create` # # Determine when initial synchronisation has been completed # -update request { - &Tmp-String-0 := $ENV{REDIS_TEST_SERVER} -} +&Tmp-String-0 := $ENV{REDIS_TEST_SERVER} + if (!&Tmp-String-0 || (&Tmp-String-0 == '')) { - update request { - &Tmp-String-0 := "$ENV{REDIS_IPPOOL_TEST_SERVER}" - } + &Tmp-String-0 := "$ENV{REDIS_IPPOOL_TEST_SERVER}" } # Test nodes should be running on @@ -81,14 +73,10 @@ foreach &control.Tmp-Integer-0 { } } - update request { - &Module-Failure-Message !* ANY - } + &request -= &Module-Failure-Message[*] # Perform checks every 0.5 seconds - update { - &Tmp-Integer-0 := `/bin/sleep 0.5` - } + &Tmp-Integer-0 := `/bin/sleep 0.5` if ("%{Foreach-Variable-0}" == 10) { test_fail diff --git a/src/tests/modules/redis_ippool/alloc.unlang b/src/tests/modules/redis_ippool/alloc.unlang index cde0308a2a1..b56ccbb53de 100644 --- a/src/tests/modules/redis_ippool/alloc.unlang +++ b/src/tests/modules/redis_ippool/alloc.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_alloc' -} +&control.IP-Pool.Name := 'test_alloc' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Check allocation @@ -33,9 +29,7 @@ if (&reply.Framed-IP-Address == 192.168.0.1) { # # Check ZSCORE # -update request { - &Tmp-Date-0 := "%l" -} +&Tmp-Date-0 := "%l" if ("%{expr:%(redis:ZSCORE "{%{control.IP-Pool.Name}}:pool" %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" > 20) { test_pass @@ -94,19 +88,15 @@ if (&reply.Session-Timeout == 30) { test_fail } -update { - &request.IP-Pool.Range := &reply.IP-Pool.Range - &request.Framed-IP-Address := &reply.Framed-IP-Address - &request.Session-Timeout := &reply.Session-Timeout # We should get the same lease time - &reply !* ANY -} +&IP-Pool.Range := &reply.IP-Pool.Range +&Framed-IP-Address := &reply.Framed-IP-Address +&Session-Timeout := &reply.Session-Timeout # We should get the same lease time +&reply := {} # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` # # Check we get the same lease, with the same lease time @@ -121,7 +111,7 @@ if (updated) { # # Check the ranges are the same # -if (&request.IP-Pool.Range == &reply.IP-Pool.Range) { +if (&IP-Pool.Range == &reply.IP-Pool.Range) { test_pass } else { test_fail @@ -130,7 +120,7 @@ if (&request.IP-Pool.Range == &reply.IP-Pool.Range) { # # Check the IP addresses are the same # -if (&request.Framed-IP-Address == &reply.Framed-IP-Address) { +if (&Framed-IP-Address == &reply.Framed-IP-Address) { test_pass } else { test_fail @@ -142,22 +132,18 @@ if (&request.Framed-IP-Address == &reply.Framed-IP-Address) { # The fudge factor is to allow for delays running ippool tool and script interpretation # as we should be allocating the same lesase as before, but its TTL could be slightly lower. # -if ("%{expr:&request.Session-Timeout - &reply.Session-Timeout}" < 5) { +if ("%{expr:&Session-Timeout - &reply.Session-Timeout}" < 5) { test_pass } else { test_fail } -update { - &reply !* ANY -} +&reply := {} # # Now change the Calling-Station-ID and check we get a different lease # -update request { - &Calling-Station-ID := 'another_mac' -} +&Calling-Station-ID := 'another_mac' redis_ippool if (updated) { @@ -175,6 +161,4 @@ if (&reply.Framed-IP-Address == 192.168.1.1) { test_fail } -update { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/redis_ippool/pool_tool_delete.unlang b/src/tests/modules/redis_ippool/pool_tool_delete.unlang index 8fd75e77d07..c2f5840ae3b 100644 --- a/src/tests/modules/redis_ippool/pool_tool_delete.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_delete.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_delete' -} +&control.IP-Pool.Name := 'test_delete' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Check allocation @@ -35,9 +31,7 @@ if (&reply.Framed-IP-Address == 192.168.0.1) { # # Delete the IP address # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -d 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -d 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Verify the association with the device has been removed @@ -64,6 +58,4 @@ if ("%(redis:ZCOUNT {%{control.IP-Pool.Name}%}:pool -inf +inf)" == 0) { test_fail } -update { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/redis_ippool/pool_tool_modify.unlang b/src/tests/modules/redis_ippool/pool_tool_modify.unlang index daae3786699..89eaf9a8732 100644 --- a/src/tests/modules/redis_ippool/pool_tool_modify.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_modify.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_update' -} +&control.IP-Pool.Name := 'test_update' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Verify the range was set OK @@ -26,9 +22,7 @@ if ("%(redis:HGET {%{control.IP-Pool.Name}}:ip:192.168.0.1 range)" == '192.168.0 # # Modify the range # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -m 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 10.0.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -m 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 10.0.0.0` # # Check it was updated diff --git a/src/tests/modules/redis_ippool/pool_tool_release.unlang b/src/tests/modules/redis_ippool/pool_tool_release.unlang index cb10f242b7a..2621275b9c3 100644 --- a/src/tests/modules/redis_ippool/pool_tool_release.unlang +++ b/src/tests/modules/redis_ippool/pool_tool_release.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_update' -} +&control.IP-Pool.Name := 'test_update' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Check allocation @@ -35,9 +31,7 @@ if (&reply.Framed-IP-Address == 192.168.0.1) { # # Release the IP address # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -r 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -r 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Verify the association with the device has been removed @@ -76,6 +70,4 @@ if ("%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address})" test_fail } -update { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/redis_ippool/release.unlang b/src/tests/modules/redis_ippool/release.unlang index 6e0b3e1ff70..edf7851b326 100644 --- a/src/tests/modules/redis_ippool/release.unlang +++ b/src/tests/modules/redis_ippool/release.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_update' -} +&control.IP-Pool.Name := 'test_update' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # # Check allocation @@ -35,10 +31,9 @@ if (&reply.Framed-IP-Address == 192.168.0.1) { # # Release the IP address # -update { - &request.Framed-IP-Address := &reply.Framed-IP-Address - &control.IP-Pool.Action := Release -} +&Framed-IP-Address := &reply.Framed-IP-Address +&control.IP-Pool.Action := Release + redis_ippool { invalid = 1 } @@ -79,9 +74,7 @@ if ("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} range) } # Check the ZSCORE -update request { - &Tmp-Date-0 := "%l" -} +&Tmp-Date-0 := "%l" if ("%{expr:%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" > 0) { test_pass @@ -98,10 +91,9 @@ if ("%{expr:%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Addr # # Release the IP address again (should still be fine) # -update { - &request.Framed-IP-Address := &reply.Framed-IP-Address - &control.IP-Pool.Action := Release -} +&Framed-IP-Address := &reply.Framed-IP-Address +&control.IP-Pool.Action := Release + redis_ippool { invalid = 1 } @@ -111,6 +103,4 @@ if (updated) { test_fail } -update reply { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/redis_ippool/update.unlang b/src/tests/modules/redis_ippool/update.unlang index acff7616d05..3e028ab0571 100644 --- a/src/tests/modules/redis_ippool/update.unlang +++ b/src/tests/modules/redis_ippool/update.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_update' -} +&control.IP-Pool.Name := 'test_update' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # 1. Check allocation redis_ippool @@ -44,16 +40,13 @@ if ("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} gatewa } # 5. Add another IP addresses -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.1.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.1.0` # 6. Verify that the lease time is extended -update { - &request.Framed-IP-Address := &reply.Framed-IP-Address - &request.NAS-IP-Address := 127.0.0.2 - &control.IP-Pool.Action := Renew -} +&Framed-IP-Address := &reply.Framed-IP-Address +&NAS-IP-Address := 127.0.0.2 +&control.IP-Pool.Action := Renew + redis_ippool if (updated) { test_pass @@ -69,9 +62,7 @@ if (&reply.Session-Timeout == 60) { } # 8. Check ZSCORE reflects that -update request { - &Tmp-Date-0 := "%l" -} +&Tmp-Date-0 := "%l" if ("%{expr:%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) - %(integer:%{Tmp-Date-0})}" > 50) { test_pass @@ -101,7 +92,7 @@ if ("%(redis:TTL {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" == 60) } # 12. Verify the gateway was updated -if ("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{request.Framed-IP-Address} gateway)" == '127.0.0.2') { +if ("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{Framed-IP-Address} gateway)" == '127.0.0.2') { test_pass } else { test_fail @@ -115,9 +106,8 @@ if (&reply.IP-Pool.Range && (&reply.IP-Pool.Range == '192.168.0.0')) { } # Change the ip address to one that doesn't exist in the pool and check we *can't* update it -update request { - &request.Framed-IP-Address := 192.168.3.1 -} +&Framed-IP-Address := 192.168.3.1 + redis_ippool { invalid = 1 } @@ -127,14 +117,11 @@ if (notfound) { } else { test_fail } -update request { - &request.Framed-IP-Address := 192.168.0.1 -} +&Framed-IP-Address := 192.168.0.1 # 15. Now change the calling station ID and check that we *can't* update the lease -update request { - &Calling-Station-ID := 'naughty' -} +&Calling-Station-ID := 'naughty' + redis_ippool { invalid = 1 } @@ -151,6 +138,4 @@ if (&reply.Framed-IP-Address == "%(redis:GET {%{control.IP-Pool.Name}}:device:00 test_fail } -update { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/redis_ippool/update_alloc.unlang b/src/tests/modules/redis_ippool/update_alloc.unlang index f069c4fb5b8..dba65105942 100644 --- a/src/tests/modules/redis_ippool/update_alloc.unlang +++ b/src/tests/modules/redis_ippool/update_alloc.unlang @@ -3,16 +3,12 @@ # $INCLUDE cluster_reset.inc -update control { - &IP-Pool.Name := 'test_update' -} +&control.IP-Pool.Name := 'test_update' # # Add IP addresses # -update request { - &Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` -} +&Tmp-String-0 := `./build/bin/local/rlm_redis_ippool_tool -a 192.168.0.1/32 $ENV{REDIS_IPPOOL_TEST_SERVER}:30001 %{control.IP-Pool.Name} 192.168.0.0` # 1. Check allocation redis_ippool @@ -25,11 +21,10 @@ if (updated) { # # Attempt to reserve an IP address by performing a renew # -update { - &request.Framed-IP-Address := 192.168.0.1 - &request.NAS-IP-Address := 127.0.0.1 - &control.IP-Pool.Action := Renew -} +&Framed-IP-Address := 192.168.0.1 +&NAS-IP-Address := 127.0.0.1 +&control.IP-Pool.Action := Renew + redis_ippool # 3. Check the expiry attribute is present and correct @@ -53,6 +48,4 @@ if (&reply.Framed-IP-Address == 192.168.0.1) { test_fail } -update { - &reply !* ANY -} +&reply := {} diff --git a/src/tests/modules/rest/rest_module.unlang b/src/tests/modules/rest/rest_module.unlang index fd01b9923bb..3206e691bb3 100644 --- a/src/tests/modules/rest/rest_module.unlang +++ b/src/tests/modules/rest/rest_module.unlang @@ -1,7 +1,5 @@ # Pre-set Tmp-String-2 to check correct operator behaviour -update control { - &Tmp-String-2 := "foo" -} +&control.Tmp-String-2 := "foo" # Test "authorize" rest call. Uses http to a GET end point rest @@ -34,16 +32,12 @@ if ((&control.Tmp-String-2[0] != "Bob") || (&control.Tmp-String-2[1] != "foo")) } # Reset control attributes -update control { - &Tmp-String-0 !* ANY - &Tmp-String-1 !* ANY - &User-Name !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &User-Name[*] # Pre-fill NAS-IP-Address to check operator behaviour -update control { - &NAS-IP-Address := "10.0.0.10" -} +&control.NAS-IP-Address := "10.0.0.10" # Test "accounting" rest call. Uses https to a POST end point rest.accounting diff --git a/src/tests/modules/rest/rest_xlat.unlang b/src/tests/modules/rest/rest_xlat.unlang index 178c5e29ca0..aca84409363 100644 --- a/src/tests/modules/rest/rest_xlat.unlang +++ b/src/tests/modules/rest/rest_xlat.unlang @@ -2,17 +2,13 @@ # PRE rest_module eval # -update request { - &Tmp-String-0 := "$ENV{REST_TEST_SERVER}" - &Tmp-Integer-0 := "$ENV{REST_TEST_SERVER_PORT}" - &Tmp-Integer-1 := "$ENV{REST_TEST_SERVER_SSL_PORT}" - &Tmp-String-1 := "notfound" -} +&Tmp-String-0 := "$ENV{REST_TEST_SERVER}" +&Tmp-Integer-0 := "$ENV{REST_TEST_SERVER_PORT}" +&Tmp-Integer-1 := "$ENV{REST_TEST_SERVER_SSL_PORT}" +&Tmp-String-1 := "notfound" # Retrieve a plain text file -update control { - &Tmp-String-1 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/test.txt)" -} +&control.Tmp-String-1 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/test.txt)" if (&REST-HTTP-Status-Code != 200) { test_fail @@ -23,36 +19,28 @@ if (&control.Tmp-String-1 != "Sample text response\n") { } # Take host from incomming packet -update control { - &Tmp-String-1 := "%(rest:http://%{Login-IP-Host}:%{Tmp-Integer-0}/test.txt)" -} +&control.Tmp-String-1 := "%(rest:http://%{Login-IP-Host}:%{Tmp-Integer-0}/test.txt)" if ((&REST-HTTP-Status-Code != 200) || (&control.Tmp-String-1 != "Sample text response\n")) { test_fail } # Port is not allowed from incomming packet -update control { - &Tmp-String-1 := "%(rest:http://%{Tmp-String-0}:%{NAS-Port}/test.txt)" -} +&control.Tmp-String-1 := "%(rest:http://%{Tmp-String-0}:%{NAS-Port}/test.txt)" if ((&Module-Failure-Message != "Failed escaping URI: Tainted value not allowed for port") || (&control.Tmp-String-1 != "")) { test_fail } # Check a "not found" gives a 404 status code -update control { - &Tmp-String-1 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/%{Tmp-String-1})" -} +&control.Tmp-String-1 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/%{Tmp-String-1})" if (&REST-HTTP-Status-Code != 404) { test_fail } # GET with URL parameters -update request { - &Tmp-String-2 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/mac/%{Called-Station-Id})" -} +&Tmp-String-2 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/mac/%{Called-Station-Id})" if (&REST-HTTP-Status-Code != 200) { test_fail @@ -71,9 +59,7 @@ if (&control.User-Name != "Bob") { test_fail } -update control { - &Tmp-String-3 := 'dummy' -} +&control.Tmp-String-3 := 'dummy' # Directly use json map and prepend the returned value map json "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/mac/%{Called-Station-Id})" { @@ -84,14 +70,10 @@ if ((&control.Tmp-String-3[0] != 'Bob') || (&control.Tmp-String-3[1] != 'dummy') test_fail } -update control { - &Tmp-String-2 = "%{json_encode:&request.NAS-IP-Address}" -} +&control.Tmp-String-2 = "%{json_encode:&NAS-IP-Address}" # POST to https with JSON body data -update request { - &Tmp-String-2 := "%(rest:POST https://%{Tmp-String-0}:%{Tmp-Integer-1}/user/%{User-Name}/mac/%{Called-Station-Id}?section=accounting %{control.Tmp-String-2})" -} +&Tmp-String-2 := "%(rest:POST https://%{Tmp-String-0}:%{Tmp-Integer-1}/user/%{User-Name}/mac/%{Called-Station-Id}?section=accounting %{control.Tmp-String-2})" if (&REST-HTTP-Status-Code != 200) { test_fail @@ -115,14 +97,10 @@ if (&control.NAS-IP-Address != "192.168.1.1") { test_fail } -update control { - &Tmp-String-2 := "NAS=%{NAS-IP-Address}&user=%{User-Name}" -} +&control.Tmp-String-2 := "NAS=%{NAS-IP-Address}&user=%{User-Name}" # POST to https with POST body data -update request { - &Tmp-String-2 := "%(rest:POST https://%{Tmp-String-0}:%{Tmp-Integer-1}/post/test?section=dummy %{control.Tmp-String-2})" -} +&Tmp-String-2 := "%(rest:POST https://%{Tmp-String-0}:%{Tmp-Integer-1}/post/test?section=dummy %{control.Tmp-String-2})" if (&REST-HTTP-Status-Code != 200) { test_fail @@ -134,31 +112,22 @@ if (&Tmp-String-2 != "Section: dummy, User: Bob\n") { # URI with tainted values in the arguments - input argument includes URI argument # separator - make sure this doesn't end up generating extra arguments, but gets escaped. -update request { - &Tmp-String-2 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/?station=%{Calling-Station-Id})" -} +&Tmp-String-2 := "%(rest:GET http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/?station=%{Calling-Station-Id})" if (&Tmp-String-2 != "{\"station\":\"dummy&unsafe=escaped\"}\n" ) { test_fail } # Zero length untainted value - check parsing doesn't break on zero length string -update request { - &Tmp-String-8 := "" -} - -update request { - &Tmp-String-2 := "%(rest:http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/%{Tmp-String-8}?station=%{User-Name})" -} +&Tmp-String-8 := "" +&Tmp-String-2 := "%(rest:http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/%{Tmp-String-8}?station=%{User-Name})" if (&Tmp-String-2 != "{\"station\":\"Bob\"}\n" ) { test_fail } # Zero length tainted value - check escaping doesn't break on zero length string -update request { - &Tmp-String-2 := "%(rest:http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/%{Tmp-String-9}?station=%{Called-Station-Id})" -} +&Tmp-String-2 := "%(rest:http://%{Tmp-String-0}:%{Tmp-Integer-0}/user/%{User-Name}/reflect/%{Tmp-String-9}?station=%{Called-Station-Id})" if (&Tmp-String-2 != "{\"station\":\"aa:bb:cc:dd:ee:ff\"}\n" ) { test_fail diff --git a/src/tests/modules/smtp/smtp_attachment/tls_attachment.unlang b/src/tests/modules/smtp/smtp_attachment/tls_attachment.unlang index d1e52073f58..ce3a41fa2c8 100644 --- a/src/tests/modules/smtp/smtp_attachment/tls_attachment.unlang +++ b/src/tests/modules/smtp/smtp_attachment/tls_attachment.unlang @@ -1,18 +1,16 @@ +&request += { + &SMTP-Mail-Header = "x-test-Subject: smtp test" + &SMTP-Mail-Body = "sent from the smtp test module\r\n" + &SMTP-Recipients = "smtp_attachment_receiver@localhost" -update request { - &SMTP-Mail-Header += "x-test-Subject: smtp test" - &SMTP-Mail-Body += "sent from the smtp test module\r\n" + &SMTP-TO = "smtp_to_1@localhost" + &SMTP-TO = "smtp_to_2@localhost" - &SMTP-Recipients += "smtp_attachment_receiver@localhost" + &SMTP-CC = "smtp_cc_1@localhost" + &SMTP-CC = "smtp_cc_2@localhost" - &SMTP-TO += "smtp_to_1@localhost" - &SMTP-TO += "smtp_to_2@localhost" - - &SMTP-CC += "smtp_cc_1@localhost" - &SMTP-CC += "smtp_cc_2@localhost" - - &SMTP-Attachments += "testfile" + &SMTP-Attachments = "testfile" } smtp.authorize @@ -38,9 +36,7 @@ echo $?"` == "1") { if (`/bin/sh -c "cat build/ci/exim4/mail/smtp_attachment_receiver | \ grep -E '^[A-Za-z0-9+/]{4}*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$' | base64 -d | tr -d '\r\n' | \ grep -f build/ci/exim4/testfile"`){ - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/smtp/smtp_authenticate/tls_authenticate.unlang b/src/tests/modules/smtp/smtp_authenticate/tls_authenticate.unlang index ef676706fca..2b001957cb0 100644 --- a/src/tests/modules/smtp/smtp_authenticate/tls_authenticate.unlang +++ b/src/tests/modules/smtp/smtp_authenticate/tls_authenticate.unlang @@ -1,24 +1,22 @@ -update request { - &SMTP-Mail-Header += "Subject: smtp test" - &SMTP-Mail-Header += "FROM: smtp_sender@gmail.com" - &SMTP-Mail-Header += "TO: smtp_receiver@localhost" - &SMTP-Mail-Body += "sent from the smtp test module\r\n" - &SMTP-Sender-Address += "smtp_sender@localhost" - &SMTP-Recipients += "smtp_receiver@localhost" - &SMTP-Attachments += "testfile" +&request += { + &SMTP-Mail-Header = "Subject: smtp test" + &SMTP-Mail-Header = "FROM: smtp_sender@gmail.com" + &SMTP-Mail-Header = "TO: smtp_receiver@localhost" + &SMTP-Mail-Body = "sent from the smtp test module\r\n" + &SMTP-Sender-Address = "smtp_sender@localhost" + &SMTP-Recipients = "smtp_receiver@localhost" + &SMTP-Attachments = "testfile" } smtp.authenticate if(ok) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject } -if (&request.TLS-Certificate.Issuer =~ /@example\.org/) { +if (&TLS-Certificate.Issuer =~ /@example\.org/) { test_pass } else { test_fail diff --git a/src/tests/modules/smtp/smtp_crln/tls_crln.unlang b/src/tests/modules/smtp/smtp_crln/tls_crln.unlang index 6383b633e47..c75a03827a4 100644 --- a/src/tests/modules/smtp/smtp_crln/tls_crln.unlang +++ b/src/tests/modules/smtp/smtp_crln/tls_crln.unlang @@ -1,14 +1,14 @@ -update request { - &SMTP-Mail-Body += "sent from the smtp test module\r\n" - &SMTP-Mail-Body += "\r\n" - &SMTP-Mail-Body += "Some Body\r\n" - &SMTP-Mail-Body += ".\r\n" - &SMTP-Mail-Body += "More Body\r\n" - &SMTP-Mail-Body += "." - &SMTP-Mail-Body += "Most Body\r\n" +&request += { + &SMTP-Mail-Body = "sent from the smtp test module\r\n" + &SMTP-Mail-Body = "\r\n" + &SMTP-Mail-Body = "Some Body\r\n" + &SMTP-Mail-Body = ".\r\n" + &SMTP-Mail-Body = "More Body\r\n" + &SMTP-Mail-Body = "." + &SMTP-Mail-Body = "Most Body\r\n" - &SMTP-Recipients += "crln_test_receiver@localhost" - &SMTP-Sender-Address += "smtp_sender@localhost" + &SMTP-Recipients = "crln_test_receiver@localhost" + &SMTP-Sender-Address = "smtp_sender@localhost" } smtp.authorize @@ -28,15 +28,13 @@ echo $?"` == "1") { if (`/bin/sh -c "cat build/ci/exim4/mail/crln_test_receiver | \ grep -E 'Most Body'"`) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject } -if (&request.TLS-Certificate.Issuer =~ /@example\.org/) { +if (&TLS-Certificate.Issuer =~ /@example\.org/) { test_pass } else { test_fail diff --git a/src/tests/modules/smtp/smtp_stringparse/tls_stringparse.unlang b/src/tests/modules/smtp/smtp_stringparse/tls_stringparse.unlang index 959aaa9a3af..6f26d3d1ea7 100644 --- a/src/tests/modules/smtp/smtp_stringparse/tls_stringparse.unlang +++ b/src/tests/modules/smtp/smtp_stringparse/tls_stringparse.unlang @@ -1,11 +1,9 @@ -update request { - &SMTP-Mail-Body += "sent from the smtp test module\r\n" - - &SMTP-Recipients += "stringparse_test_receiver@localhost" - - &SMTP-Sender-Address += "smtp_sender@localhost" - &SMTP-Sender-Address += "smtp_sender_2@localhost" - &SMTP-Sender-Address += "smtp_sender_3@localhost" +&request += { + &SMTP-Mail-Body = "sent from the smtp test module\r\n" + &SMTP-Recipients = "stringparse_test_receiver@localhost" + &SMTP-Sender-Address = "smtp_sender@localhost" + &SMTP-Sender-Address = "smtp_sender_2@localhost" + &SMTP-Sender-Address = "smtp_sender_3@localhost" } smtp.authorize @@ -25,15 +23,13 @@ echo $?"` == "1") { if (`/bin/sh -c "cat build/ci/exim4/mail/stringparse_test_receiver | \ grep -E 'Subject: for Bob'"`) { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject } -if (&request.TLS-Certificate.Issuer =~ /@example\.org/) { +if (&TLS-Certificate.Issuer =~ /@example\.org/) { test_pass } else { test_fail diff --git a/src/tests/modules/smtp/tls_delivery.unlang b/src/tests/modules/smtp/tls_delivery.unlang index b806639600e..30e48ecefc5 100644 --- a/src/tests/modules/smtp/tls_delivery.unlang +++ b/src/tests/modules/smtp/tls_delivery.unlang @@ -1,17 +1,17 @@ -update request { - &SMTP-Mail-Header += "x-test-Subject: smtp test" - &SMTP-Mail-Body += "sent from the smtp test module\r\n" +&request += { + &SMTP-Mail-Header = "x-test-Subject: smtp test" + &SMTP-Mail-Body = "sent from the smtp test module\r\n" - &SMTP-Recipients += "smtp_delivery_receiver@localhost" - &SMTP-Recipients += "smtp_recipient_request@localhost" + &SMTP-Recipients = "smtp_delivery_receiver@localhost" + &SMTP-Recipients = "smtp_recipient_request@localhost" - &SMTP-TO += "smtp_to_request_1@localhost" - &SMTP-TO += "smtp_to_request_2@localhost" + &SMTP-TO = "smtp_to_request_1@localhost" + &SMTP-TO = "smtp_to_request_2@localhost" - &SMTP-CC += "smtp_cc_request_1@localhost" - &SMTP-CC += "smtp_cc_request_2@localhost" + &SMTP-CC = "smtp_cc_request_1@localhost" + &SMTP-CC = "smtp_cc_request_2@localhost" - &SMTP-Attachments += "testfile" + &SMTP-Attachments = "testfile" } smtp.authorize @@ -56,9 +56,7 @@ done ;"` == "found")) { if (`/bin/sh -c "cat build/ci/exim4/mail/smtp_delivery_receiver | \ grep -E '^[A-Za-z0-9+/]{4}*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$' | base64 -d | tr -d '\r\n' | \ grep -f build/ci/exim4/testfile"`){ - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } else { reject diff --git a/src/tests/modules/sql/acct_start_conflict.unlang b/src/tests/modules/sql/acct_start_conflict.unlang index 45da5fdf84a..58909717297 100644 --- a/src/tests/modules/sql/acct_start_conflict.unlang +++ b/src/tests/modules/sql/acct_start_conflict.unlang @@ -35,9 +35,8 @@ if ("%{sql:SELECT acctsessiontime FROM radacct WHERE AcctSessionId = '00000003'} # # Change acctsessiontime and verify it's updated # -update request { - &Connect-Info = 'updated' -} +&Connect-Info = 'updated' + sql.accounting if (ok) { test_pass diff --git a/src/tests/modules/sql/groups.unlang b/src/tests/modules/sql/groups.unlang index d95019848f9..6f03ee19f1f 100644 --- a/src/tests/modules/sql/groups.unlang +++ b/src/tests/modules/sql/groups.unlang @@ -86,9 +86,7 @@ else { # # Test paircmp group comparisons with dynamic expansions # -update request { - &Tmp-String-0 := 'groups_group_b' -} +&Tmp-String-0 := 'groups_group_b' if (&SQL-Group == "%{Tmp-String-0}") { test_pass diff --git a/src/tests/modules/sql/map.unlang b/src/tests/modules/sql/map.unlang index 69831909a8f..e3521d013a3 100644 --- a/src/tests/modules/sql/map.unlang +++ b/src/tests/modules/sql/map.unlang @@ -74,11 +74,9 @@ else { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Insert our second test row "%{sql:INSERT INTO radusergroup (username, groupname, priority) VALUES ('oof', 'rab', 0)}" @@ -119,11 +117,9 @@ else { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Retrieve our test row(s) - With = we should get the values from the first row map sql 'SELECT * FROM radusergroup WHERE priority = 0' { @@ -161,11 +157,9 @@ else { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Retrieve our test row(s) - With ^= we should get the values from the second row then the first map sql 'SELECT * FROM radusergroup WHERE priority = 0' { @@ -193,11 +187,9 @@ if ((&control.Tmp-Integer-0[0] != 0) || (&control.Tmp-Integer-0[1] != 0)) { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Retrieve our test row(s) - With += we should get the values from both rows map sql 'SELECT * FROM radusergroup WHERE priority = 0' { @@ -249,11 +241,9 @@ else { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Retrieve the username column only (should result in noop because not in map) map sql 'SELECT username FROM radusergroup WHERE priority = 0' { @@ -303,16 +293,12 @@ else { test_fail } -update request { - &Tmp-String-0 := "SELECT * FROM radusergroup WHERE priority = 0 AND username = '%{User-Name}'" -} +&Tmp-String-0 := "SELECT * FROM radusergroup WHERE priority = 0 AND username = '%{User-Name}'" # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] # Retrieve test row with specific username (using ref'd query) map sql &Tmp-String-0 { @@ -350,16 +336,12 @@ else { } # Clear the control list -update { - &control.Tmp-String-0 !* ANY - &control.Tmp-String-1 !* ANY - &control.Tmp-Integer-0 !* ANY -} +&control -= &Tmp-String-0[*] +&control -= &Tmp-String-1[*] +&control -= &Tmp-Integer-0[*] -update request { - &Tmp-String-0 := 'username' - &Tmp-String-1 := 'name' -} +&Tmp-String-0 := 'username' +&Tmp-String-1 := 'name' # Retrieve our test row(s) - Using different RHS types map sql 'SELECT * FROM radusergroup WHERE priority = 0' { diff --git a/src/tests/modules/test/dollar_expansions.unlang b/src/tests/modules/test/dollar_expansions.unlang index 21ad0c9a75f..562e2d93155 100644 --- a/src/tests/modules/test/dollar_expansions.unlang +++ b/src/tests/modules/test/dollar_expansions.unlang @@ -1,6 +1,5 @@ -update { - &Fall-Through := yes -} +&Fall-Through := yes + # Should be compiled out if ('${a_term}' != '${a_term}') { test_fail diff --git a/src/tests/modules/test/policy.conf b/src/tests/modules/test/policy.conf index b773b67e0e5..ff86844bd27 100644 --- a/src/tests/modules/test/policy.conf +++ b/src/tests/modules/test/policy.conf @@ -37,9 +37,8 @@ section_names { } dollar_expansions { - update { - &Fall-Through := yes - } + &Fall-Through := yes + # Should be compiled out if ('${a_term}' != '${a_term}') { test_fail diff --git a/src/tests/modules/unbound/dns.unlang b/src/tests/modules/unbound/dns.unlang index b4302126ca6..5b74a389f1e 100644 --- a/src/tests/modules/unbound/dns.unlang +++ b/src/tests/modules/unbound/dns.unlang @@ -1,40 +1,30 @@ # Use builtin "local" zone -update request { - &Tmp-IP-Address-0 := "%(dns:localhost A)" -} +&Tmp-IP-Address-0 := "%(dns:localhost A)" if (&Tmp-IP-Address-0 != 127.0.0.1) { test_fail } -update request { - &Tmp-String-0 := "%(dns:localhost AAAA)" -} +&Tmp-String-0 := "%(dns:localhost AAAA)" if (&Tmp-String-0 != "::1") { test_fail } -update request { - &Tmp-String-1 := "%(dns:1.0.0.127.in-addr.arpa PTR)" -} +&Tmp-String-1 := "%(dns:1.0.0.127.in-addr.arpa PTR)" if (&Tmp-String-1 != "localhost") { test_fail } # Use local data in module config to allow for dotted names -update request { - &Tmp-IP-Address-0 := "%(dns:www.example.com A)" -} +&Tmp-IP-Address-0 := "%(dns:www.example.com A)" if (&Tmp-IP-Address-0 != 192.168.1.1) { test_fail } -update request { - &Tmp-String-0 := "%(dns:1.1.168.192.in-addr.arpa PTR)" -} +&Tmp-String-0 := "%(dns:1.1.168.192.in-addr.arpa PTR)" if (&Tmp-String-0 != "www.example.com") { test_fail @@ -51,37 +41,20 @@ if (&Tmp-String-0 != "www.example.com") { #} # Invalid query -update request { - &Tmp-String-0 := "%(dns:www.example.com ABC)" -} - -if (&Tmp-String-0 != "") { - test_fail -} +&Tmp-String-0 := "%(dns:www.example.com ABC)" if (&Module-Failure-Message != "Invalid / unsupported DNS query type") { test_fail } -update request { - &Tmp-String-0 := "" -} - -update request { - &Tmp-String-1 := "%(dns:%{Tmp-String-0} A)" -} - -if (&Tmp-String-1 != "") { - test_fail -} +&Tmp-String-0 := "" +&Tmp-String-1 := "%(dns:%{Tmp-String-0} A)" if (&Module-Failure-Message != "Can't resolve zero length host") { test_fail } -update request { - &Tmp-String-1 := "%(dns:example.com MX)" -} +&Tmp-String-1 := "%(dns:example.com MX)" # Until we can handle multiple boxes in xlat expansion, the results # are concatenated into a single string @@ -92,21 +65,13 @@ if ((&Tmp-String-1 != '10mail.example.com20mail2.example.com') && (&Tmp-String-1 # Just return a single record # As results are not in a specified order, it could be either. -update request { - &Tmp-String-1 := "%(dns:example.com MX 1)" -} +&Tmp-String-1 := "%(dns:example.com MX 1)" if ((&Tmp-String-1 != '10mail.example.com') && (&Tmp-String-1 != '20mail2.example.com')) { test_fail } -update request { - &Tmp-String-1 := "%(dns:n0nex1stent.d0ma1n A)" -} - -if (&Tmp-String-1 != "") { - test_fail -} +&Tmp-String-1 := "%(dns:n0nex1stent.d0ma1n A)" # Running this on macOS produces a timeout due to the nonexistent TLD if ((&Module-Failure-Message != "dns - Nonexistent domain name") && (&Module-Failure-Message != "Timeout waiting for DNS resolution")) { diff --git a/src/tests/modules/unit_test_module.conf b/src/tests/modules/unit_test_module.conf index 1562687f42e..c8983aca4dd 100644 --- a/src/tests/modules/unit_test_module.conf +++ b/src/tests/modules/unit_test_module.conf @@ -56,14 +56,12 @@ server default { policy { test_pass { - update control { - &Auth-Type := Accept - } + &control.Auth-Type := Accept } test_fail { - update reply { - &Reply-Message += "Failure in test at line %(interpreter:...line)" + &reply += { + &Reply-Message = "Failure in test at line %(interpreter:...line)" } reject } diff --git a/src/tests/modules/yubikey/yubikey_xlat.unlang b/src/tests/modules/yubikey/yubikey_xlat.unlang index 07329add150..edb76e55e7c 100644 --- a/src/tests/modules/yubikey/yubikey_xlat.unlang +++ b/src/tests/modules/yubikey/yubikey_xlat.unlang @@ -1,20 +1,12 @@ - -update request { - &Tmp-String-0 := "vvrbuctetdhc" -} - -update request { - &Tmp-String-1 := "%{modhextohex:%{Tmp-String-0}}" -} +&Tmp-String-0 := "vvrbuctetdhc" +&Tmp-String-1 := "%{modhextohex:%{Tmp-String-0}}" if (&Tmp-String-1 != "ffc1e0d3d260") { test_fail } # Invalid modhex string - not even length -update request { - &Tmp-String-0 := "vvrbuctetdh" -} +&Tmp-String-0 := "vvrbuctetdh" update request { &Tmp-String-1 := "%{modhextohex:%{Tmp-String-0}}"