]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
change "%{Attr-Name}" to &Attr-Name
authorAlan T. DeKok <aland@freeradius.org>
Tue, 6 Dec 2022 16:54:06 +0000 (11:54 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 6 Dec 2022 17:24:43 +0000 (12:24 -0500)
It's really not clear where this obsession with quoting came from,
but it's unnecessary.

17 files changed:
src/tests/keywords/escape-sequences
src/tests/keywords/if-regex-match
src/tests/keywords/if-regex-match-comp
src/tests/keywords/map-csv-prepend
src/tests/keywords/pap
src/tests/keywords/parallel
src/tests/keywords/redundant
src/tests/keywords/update-null-value-assign
src/tests/keywords/update-prepend
src/tests/keywords/update-remove-any
src/tests/keywords/update-remove-index
src/tests/keywords/update-remove-value
src/tests/keywords/xlat-attr-index
src/tests/keywords/xlat-integer
src/tests/keywords/xlat-octets
src/tests/keywords/xlat-soh
src/tests/keywords/xlat-unknown

index 0ee571a01e69f240385afa604c638f9c2cbf8e96..9cad10df664391e502b33da5a370c8f0d3f90406 100644 (file)
@@ -45,7 +45,7 @@ if (!("%{Tmp-String-0[0]}" == "i have scary embedded things\000 inside me")) {
        test_fail
 }
 
-if (!("%{Tmp-String-0[1]}" == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) {
+if (!(&Tmp-String-0[1] == "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°")) {
        test_fail
 }
 
@@ -62,7 +62,7 @@ if (!(&Tmp-String-0[0] == &Tmp-String-0[0])) {
 #  This seems weird... double escapes for most things, but single escapes
 #  for the quotation marks.
 #
-if (!("%{Tmp-String-2[1]}" == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) {
+if (!(&Tmp-String-2[1] == "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°")) {
        test_fail
 }
 
index ff135575d6c7f6568b8052ca7ee225f93715d2cb..fa205fa891438188727a7d0fd4bd10f3a18d49b4 100644 (file)
@@ -67,7 +67,7 @@ if (&Calling-Station-Id !~ /:roamyroam%{Tmp-String-0}$/i) {
 }
 
 # uncompiled - expansion - insensitive
-if ("%{Calling-Station-Id}" !~ /:roamyroam%{Tmp-String-0}$/i) {
+if (&Calling-Station-Id !~ /:roamyroam%{Tmp-String-0}$/i) {
        test_fail
 }
 
index 4c147242d939d3460fb21a22470fab16a3e46765..82b679444d51ca44b304ac9f229c4c99b7db6514 100644 (file)
@@ -46,7 +46,7 @@ if (&Calling-Station-Id !~ /:roamyroam$/i) {
 }
 
 # compiled - expansion - insensitive
-if ("%{Calling-Station-Id}" !~ /:roamyroam$/i) {
+if (&Calling-Station-Id !~ /:roamyroam$/i) {
        test_fail
 }
 
index 34d41a5e7428b6d7f3a79b1a1fafcf8d63c6a699..1a28c782ee620df27d8dc0231f444f36b9ffb4ff 100644 (file)
@@ -8,15 +8,15 @@ map csv &User-Name {
        &control.Tmp-String-0 ^= 'field3'
 }
 
-if (!("%{control.Tmp-String-0[0]}" == 'success')) {
+if (!(&control.Tmp-String-0[0] == 'success')) {
        test_fail
 }
 
-if (!("%{control.Tmp-String-0[1]}" == "fail")) {
+if (!(&control.Tmp-String-0[1] == "fail")) {
        test_fail
 }
 
-if (!("%{control.Tmp-String-0[#]}" == 2)) {
+if (!(%{control.Tmp-String-0[#]} == 2)) {
        test_fail
 }
 
index 033b64121447273e25fa63c1b261e29960db9b10..71946c4597d51581e76d88eddf9249f3325e6a3f 100644 (file)
@@ -8,7 +8,7 @@
 #  Unencoded Password.Cleartext in password with header
 #
 &control := {
-       &Password.With-Header = "%{User-Password}"
+       &Password.With-Header = &User-Password
 }
 
 pap.authorize
index ceecf2698dc1be5c823d890a37cff24ce758c6bc..e4b9231e0dd6cc9a42df6f117f15def6f7769a2b 100644 (file)
@@ -21,7 +21,7 @@ parallel {
        }
 }
 
-if (!("%{control.Tmp-Integer-0[#]}" == 4)) {
+if (!(%{control.Tmp-Integer-0[#]} == 4)) {
        test_fail
 }
 
index 17dcb412539dbdcaab8c4acb451f5cccf814b2c1..94cf59f755901d532b9052c0d1d40d237262fbef 100644 (file)
@@ -66,7 +66,7 @@ foreach &Tmp-Integer-1 {
        }
 }
 
-if (!(&Tmp-Integer-0 == "%{Tmp-Integer-1[#]}")) {
+if (!(&Tmp-Integer-0 == %{Tmp-Integer-1[#]})) {
        test_fail
 }
 
index f3130c2de3f6f283d87c2d41c3211523f723feea..f59f18bd09efd11dda3eaedad07e7d2e2814d682 100644 (file)
@@ -7,16 +7,15 @@
 #  Tmp-Octets-1 doesn't exist, so Tmp-Octets-0 shouldn't be created
 #
 update request {
-       &Tmp-Octets-0 := "%{Tmp-Octets-1}"
+       &Tmp-Octets-0 := &Tmp-Octets-1
 }
-if (&Tmp-Integer-0) {
+if (&Tmp-Octets-0) {
        test_fail
 }
 
 #
-#  NULL valued strings get converted to empty length strings
+#  Strings which quote NULL expansions still result in zero-length strings.
 #
-#  @fixme - EDIT - the new method is to simply omit the assignment
 #
 update request {
        &Tmp-String-0 := "%{Reply-Message}"
index 4666f981079bed969e7c90ff57c8b957303ea3d8..1c5d0a136e9a0da8b2a2d5ff6be8ba7f7290a869 100644 (file)
@@ -28,11 +28,11 @@ update request {
 }
 
 # The prepended value should be first followd by the other two
-if (!(("%{Tmp-String-0[0]}" == 'boink')) || (!("%{Tmp-String-0[1]}" == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz'))) {
+if (!((&Tmp-String-0[0] == 'boink')) || (!(&Tmp-String-0[1] == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz'))) {
        test_fail
 }
 
-if (!("%{Tmp-String-0[#]}" == 3)) {
+if (!(%{Tmp-String-0[#]} == 3)) {
        test_fail
 }
 
@@ -47,11 +47,11 @@ update {
 }
 
 # The attributes should now be "wibble", "foo", "baz", "boink", "foo", "baz"
-if (!(("%{Tmp-String-0[0]}" == 'wibble')) || (!("%{Tmp-String-0[1]}" == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz')) || (!("%{Tmp-String-0[3]}" == 'boink')) || (!("%{Tmp-String-0[4]}" == 'foo')) || (!("%{Tmp-String-0[5]}" == 'baz'))) {
+if (!((&Tmp-String-0[0] == 'wibble')) || (!(&Tmp-String-0[1] == 'foo')) || (!(%{Tmp-String-0[2]} == 'baz')) || (!(&Tmp-String-0[3] == 'boink')) || (!(&Tmp-String-0[4] == 'foo')) || (!(&Tmp-String-0[5] == 'baz'))) {
        test_fail
 }
 
-if (!("%{Tmp-String-0[#]}" == 6)) {
+if (!(%{Tmp-String-0[#]} == 6)) {
        test_fail
 }
 
@@ -71,11 +71,11 @@ update {
 }
 
 # The control attributes should now be "wibble", "foo", "baz", "boink", "foo", "baz", "initial"
-if (!(("%{control.Tmp-String-0[0]}" == 'wibble')) || (!("%{control.Tmp-String-0[1]}" == 'foo')) || (!(%{control.Tmp-String-0[2]} == 'baz')) || (!("%{control.Tmp-String-0[3]}" == 'boink')) || (!("%{control.Tmp-String-0[4]}" == 'foo')) || (!("%{control.Tmp-String-0[5]}" == 'baz')) || (!("%{control.Tmp-String-0[6]}" == 'initial'))) {
+if (!((&control.Tmp-String-0[0] == 'wibble')) || (!(&control.Tmp-String-0[1] == 'foo')) || (!(&control.Tmp-String-0[2] == 'baz')) || (!(&control.Tmp-String-0[3] == 'boink')) || (!(&control.Tmp-String-0[4] == 'foo')) || (!(&control.Tmp-String-0[5] == 'baz')) || (!(&control.Tmp-String-0[6] == 'initial'))) {
        test_fail
 }
 
-if (!("%{control.Tmp-String-0[#]}" == 7)) {
+if (!(%{control.Tmp-String-0[#]} == 7)) {
        test_fail
 }
 
index 7c184159d25287d8addf0a28ebc08952f2be6062..f8c6d7f8844dfcb0d79811d4c7215f02f67e44b1 100644 (file)
@@ -11,7 +11,7 @@ update {
        &control.Tmp-IP-Address-1 := 192.0.3.1
 }
 
-if (!(("%{Tmp-IP-Address-0[0]}" == 192.0.2.1)) || (!("%{Tmp-IP-Address-0[1]}" == 192.0.2.2))) {
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&Tmp-IP-Address-0[1] == 192.0.2.2))) {
        test_fail
 }
 
@@ -26,12 +26,12 @@ if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789))) {
 }
 
 # There should be no Tmp-IP-Address attributes in the request list
-if (&Tmp-IP-Address-0 || (!("%{Tmp-IP-Address-0[1]}" == ''))) {
+if (&Tmp-IP-Address-0) {
        test_fail
 }
 
 # But there should still be some in the control list
-if (!((&control.Tmp-IP-Address-0 == 192.0.2.1)) || (!("%{control.Tmp-IP-Address-0[1]}" == 192.0.2.3))) {
+if (!((&control.Tmp-IP-Address-0 == 192.0.2.1)) || (!(&control.Tmp-IP-Address-0[1] == 192.0.2.3))) {
        test_fail
 }
 
index de38e95a4af6257ffc6b36c6e605388c02f13708..72f80da1e1c190221d64a381c86ac7c1171e3de4 100644 (file)
@@ -22,11 +22,11 @@ update request {
 }
 
 # Only the 1st, 2nd, 3rd and 5th Tmp-IP-Address attributes should still be in the list
-if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.1')) ||
-       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.2')) ||
-       (!("%{Tmp-IP-Address-0[2]}" == '192.0.2.3')) ||
-       (!("%{Tmp-IP-Address-0[3]}" == '192.0.2.4')) ||
-       (!("%{Tmp-IP-Address-0[4]}" == ''))) {
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) ||
+       (!(&Tmp-IP-Address-0[1] == 192.0.2.2)) ||
+       (!(&Tmp-IP-Address-0[2] == 192.0.2.3)) ||
+       (!(&Tmp-IP-Address-0[3] == 192.0.2.4)) ||
+       (!(&Tmp-IP-Address-0[4] == ''))) {
        test_fail
 }
 
index 32a08efbe6a5ec0ea6c41c4552efc47fff777d3c..69c02cfaf015c59d45bbc61e018932ffed248028 100644 (file)
@@ -13,10 +13,10 @@ update {
        &control.Tmp-IP-Address-0 += 192.0.2.3
 }
 
-if (!(("%{Tmp-IP-Address-0[0]}" == 192.0.2.1)) || \
-       (!("%{Tmp-IP-Address-0[1]}" == 192.0.2.2)) || \
-       (!("%{Tmp-IP-Address-0[2]}" == 192.0.2.3)) || \
-       (!("%{Tmp-IP-Address-0[3]}" == 192.0.2.4))) {
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || \
+       (!(&Tmp-IP-Address-0[1] == 192.0.2.2)) || \
+       (!(&Tmp-IP-Address-0[2] == 192.0.2.3)) || \
+       (!(&Tmp-IP-Address-0[3] == 192.0.2.4))) {
        test_fail
 }
 
@@ -26,9 +26,9 @@ update {
 }
 
 # Only the 2nd, 3rd and 4th Tmp-IP-Address attributes should still be in the list
-if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
-       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.3')) || \
-       (!("%{Tmp-IP-Address-0[2]}" == '192.0.2.4')) || \
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \
+       (!(&Tmp-IP-Address-0[1] == 192.0.2.3)) || \
+       (!(&Tmp-IP-Address-0[2] == 192.0.2.4)) || \
        (!("%{Tmp-IP-Address-0[3]}" == ''))) {
        test_fail
 }
@@ -39,8 +39,8 @@ update {
 }
 
 # Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
-if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
-       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.4')) || \
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \
+       (!(&Tmp-IP-Address-0[1] == 192.0.2.4)) || \
        (!("%{Tmp-IP-Address-0[2]}" == ''))) {
        test_fail
 }
@@ -51,8 +51,8 @@ update {
 }
 
 # Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
-if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
-       (!("%{Tmp-IP-Address-0[1]}" == '192.0.2.4')) || \
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \
+       (!(&Tmp-IP-Address-0[1] == 192.0.2.4)) || \
        (!("%{Tmp-IP-Address-0[2]}" == ''))) {
        test_fail
 }
@@ -68,7 +68,7 @@ update {
 }
 
 # Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
-if (!(("%{Tmp-IP-Address-0[0]}" == '192.0.2.2')) || \
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.2)) || \
        (!("%{Tmp-IP-Address-0[1]}" == ''))) {
        test_fail
 }
@@ -90,7 +90,7 @@ if (!((&Tmp-String-0 == 'foobarbaz')) || (!(&Tmp-Integer-0 == 123456789))) {
 }
 
 # But there should still be some in the control list
-if (!(("%{control.Tmp-IP-Address-0[0]}" == 192.0.2.1)) || (!("%{control.Tmp-IP-Address-0[1]}" == 192.0.2.3))) {
+if (!((&control.Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&control.Tmp-IP-Address-0[1] == 192.0.2.3))) {
        test_fail
 }
 
index dc167b13cf511c50199ad754f859f1c833a9f271..c4342cd2898f59960c50004d2217a8545247919e 100644 (file)
@@ -2,11 +2,11 @@
        &Tmp-IP-Address-0 = 192.0.2.1
        &Tmp-IP-Address-0 = 192.0.2.2
 }
-if (!("%{Tmp-IP-Address-0[#]}" == 2)) {
+if (!(%{Tmp-IP-Address-0[#]} == 2)) {
        test_fail
 }
 
-if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || (!("%{Tmp-IP-Address-0[1]}" == 192.0.2.2))) {
+if (!((&Tmp-IP-Address-0[0] == 192.0.2.1)) || (!(&Tmp-IP-Address-0[1] == 192.0.2.2))) {
        test_fail
 }
 
@@ -17,10 +17,10 @@ if (!("%{Tmp-IP-Address-0[*]}" == '192.0.2.1192.0.2.2')) {
 # Try calling these xlats in mapping too, they may get optimised to VPTs which is a
 # different code path.
 &request += {
-       &Tmp-IP-Address-1 = "%{Tmp-IP-Address-0[1]}"
-       &Tmp-IP-Address-1 = "%{Tmp-IP-Address-0[0]}"
+       &Tmp-IP-Address-1 = &Tmp-IP-Address-0[1]
+       &Tmp-IP-Address-1 = &Tmp-IP-Address-0[0]
        &Tmp-String-0 = "%(concat:%{Tmp-IP-Address-0[*]} ,)"
-       &Tmp-Integer-0 = "%{Tmp-IP-Address-0[#]}"
+       &Tmp-Integer-0 = %{Tmp-IP-Address-0[#]}
 }
 
 if (!(&Tmp-String-0 == '192.0.2.1,192.0.2.2')) {
index 9d445a20789d400e49f7144586034b7fc3498741..c61b0b8717b8244848bc4e045bb4c820e184dbd8 100644 (file)
@@ -50,7 +50,7 @@ if (!(&Tmp-Integer-1 == 959985457)) {
 &Tmp-uint64-0 := "%(integer:%{Tmp-Octets-1})"
 
 #
-#  Disabled until xlats can return binary data
+#  Handle octets as strings for now.
 #
 if (!("%{Tmp-Octets-1}" == "0x%{hex:%{Tmp-uint64-0}}")) {
        test_fail
index 5b07413b94bc4cc48dced1cbcd1e741b1633bc09..3fb84c90b7d029d08caeb7240abf8aa35d60c843 100644 (file)
        &Tmp-Octets-0 = 0x0706050403020100
 }
 
-if (!("%{Tmp-Octets-0}" == '0x0001020304050607')) {
+if (!(&Tmp-Octets-0 == 0x0001020304050607)) {
        test_fail
 }
 
-if (!("%{Tmp-Octets-0[0]}" == '0x0001020304050607')) {
+if (!(&Tmp-Octets-0[0] == 0x0001020304050607)) {
        test_fail
 }
 
index 7e65fb5ddfe1562d70e01e3e3b245d394fbd0172..eccc99638e5baa00edaea04b5939a3d0ae5cf3a1 100644 (file)
@@ -31,7 +31,7 @@ if (&Tmp-String-0) {
 &Tmp-String-0 := %(soh:OS)
 
 # OS version not set
-if (!("%{Tmp-String-0}" == "Windows unknown")) {
+if (!(&Tmp-String-0 == "Windows unknown")) {
        test_fail
 }
 
@@ -47,7 +47,7 @@ if !(&Tmp-String-0 == "Windows Vista / Server 2008 6.0.6001 sp 1.0" ) {
 &Tmp-String-0 := %(soh:OS)
 
 # Version and Release combination that does not exist
-if (!("%{Tmp-String-0}" == "Windows Other 6.5.6001 sp 1.0")) {
+if (!(&Tmp-String-0 == "Windows Other 6.5.6001 sp 1.0")) {
        test_fail
 }
 
@@ -56,7 +56,7 @@ if (!("%{Tmp-String-0}" == "Windows Other 6.5.6001 sp 1.0")) {
 &Tmp-String-0 := %(soh:OS)
 
 # Version that does not exist
-if (!("%{Tmp-String-0}" == "Windows Other 8.0.6001 sp 1.0")) {
+if (!(&Tmp-String-0 == "Windows Other 8.0.6001 sp 1.0")) {
        test_fail
 }
 
index 13ac85c1dbd66a2db5b4975a30c209e4618f6553..07c27deccb865b4f77515b5769b2f931214aedca 100644 (file)
@@ -10,7 +10,7 @@ update reply {
 #  reference here should be to an unknown attribute,
 #  and the dereference should fail.
 #
-if ("%{reply.WiMAX.Capability.Release}" == "foo") { # ERROR
+if (&reply.WiMAX.Capability.Release == "foo") { # ERROR
        test_fail
 }
 else {