From: Alan T. DeKok Date: Tue, 6 Dec 2022 16:54:06 +0000 (-0500) Subject: change "%{Attr-Name}" to &Attr-Name X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faa35e70b7bf19e4befefdb78d46c11676ea71d3;p=thirdparty%2Ffreeradius-server.git change "%{Attr-Name}" to &Attr-Name It's really not clear where this obsession with quoting came from, but it's unnecessary. --- diff --git a/src/tests/keywords/escape-sequences b/src/tests/keywords/escape-sequences index 0ee571a01e6..9cad10df664 100644 --- a/src/tests/keywords/escape-sequences +++ b/src/tests/keywords/escape-sequences @@ -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 } diff --git a/src/tests/keywords/if-regex-match b/src/tests/keywords/if-regex-match index ff135575d6c..fa205fa8914 100644 --- a/src/tests/keywords/if-regex-match +++ b/src/tests/keywords/if-regex-match @@ -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 } diff --git a/src/tests/keywords/if-regex-match-comp b/src/tests/keywords/if-regex-match-comp index 4c147242d93..82b679444d5 100644 --- a/src/tests/keywords/if-regex-match-comp +++ b/src/tests/keywords/if-regex-match-comp @@ -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 } diff --git a/src/tests/keywords/map-csv-prepend b/src/tests/keywords/map-csv-prepend index 34d41a5e742..1a28c782ee6 100644 --- a/src/tests/keywords/map-csv-prepend +++ b/src/tests/keywords/map-csv-prepend @@ -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 } diff --git a/src/tests/keywords/pap b/src/tests/keywords/pap index 033b6412144..71946c4597d 100644 --- a/src/tests/keywords/pap +++ b/src/tests/keywords/pap @@ -8,7 +8,7 @@ # Unencoded Password.Cleartext in password with header # &control := { - &Password.With-Header = "%{User-Password}" + &Password.With-Header = &User-Password } pap.authorize diff --git a/src/tests/keywords/parallel b/src/tests/keywords/parallel index ceecf2698dc..e4b9231e0dd 100644 --- a/src/tests/keywords/parallel +++ b/src/tests/keywords/parallel @@ -21,7 +21,7 @@ parallel { } } -if (!("%{control.Tmp-Integer-0[#]}" == 4)) { +if (!(%{control.Tmp-Integer-0[#]} == 4)) { test_fail } diff --git a/src/tests/keywords/redundant b/src/tests/keywords/redundant index 17dcb412539..94cf59f7559 100644 --- a/src/tests/keywords/redundant +++ b/src/tests/keywords/redundant @@ -66,7 +66,7 @@ foreach &Tmp-Integer-1 { } } -if (!(&Tmp-Integer-0 == "%{Tmp-Integer-1[#]}")) { +if (!(&Tmp-Integer-0 == %{Tmp-Integer-1[#]})) { test_fail } diff --git a/src/tests/keywords/update-null-value-assign b/src/tests/keywords/update-null-value-assign index f3130c2de3f..f59f18bd09e 100644 --- a/src/tests/keywords/update-null-value-assign +++ b/src/tests/keywords/update-null-value-assign @@ -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}" diff --git a/src/tests/keywords/update-prepend b/src/tests/keywords/update-prepend index 4666f981079..1c5d0a136e9 100644 --- a/src/tests/keywords/update-prepend +++ b/src/tests/keywords/update-prepend @@ -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 } diff --git a/src/tests/keywords/update-remove-any b/src/tests/keywords/update-remove-any index 7c184159d25..f8c6d7f8844 100644 --- a/src/tests/keywords/update-remove-any +++ b/src/tests/keywords/update-remove-any @@ -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 } diff --git a/src/tests/keywords/update-remove-index b/src/tests/keywords/update-remove-index index de38e95a4af..72f80da1e1c 100644 --- a/src/tests/keywords/update-remove-index +++ b/src/tests/keywords/update-remove-index @@ -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 } diff --git a/src/tests/keywords/update-remove-value b/src/tests/keywords/update-remove-value index 32a08efbe6a..69c02cfaf01 100644 --- a/src/tests/keywords/update-remove-value +++ b/src/tests/keywords/update-remove-value @@ -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 } diff --git a/src/tests/keywords/xlat-attr-index b/src/tests/keywords/xlat-attr-index index dc167b13cf5..c4342cd2898 100644 --- a/src/tests/keywords/xlat-attr-index +++ b/src/tests/keywords/xlat-attr-index @@ -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')) { diff --git a/src/tests/keywords/xlat-integer b/src/tests/keywords/xlat-integer index 9d445a20789..c61b0b8717b 100644 --- a/src/tests/keywords/xlat-integer +++ b/src/tests/keywords/xlat-integer @@ -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 diff --git a/src/tests/keywords/xlat-octets b/src/tests/keywords/xlat-octets index 5b07413b94b..3fb84c90b7d 100644 --- a/src/tests/keywords/xlat-octets +++ b/src/tests/keywords/xlat-octets @@ -10,11 +10,11 @@ &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 } diff --git a/src/tests/keywords/xlat-soh b/src/tests/keywords/xlat-soh index 7e65fb5ddfe..eccc99638e5 100644 --- a/src/tests/keywords/xlat-soh +++ b/src/tests/keywords/xlat-soh @@ -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 } diff --git a/src/tests/keywords/xlat-unknown b/src/tests/keywords/xlat-unknown index 13ac85c1dbd..07c27deccb8 100644 --- a/src/tests/keywords/xlat-unknown +++ b/src/tests/keywords/xlat-unknown @@ -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 {