From: Alan T. DeKok Date: Fri, 29 Sep 2023 16:13:03 +0000 (-0400) Subject: start moving to the new function call syntax X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c928676a5252e9f2b5fdf7408580a3cf89806029;p=thirdparty%2Ffreeradius-server.git start moving to the new function call syntax --- diff --git a/src/tests/keywords/base64 b/src/tests/keywords/base64 index d284c01cd0f..e56919f9c3c 100644 --- a/src/tests/keywords/base64 +++ b/src/tests/keywords/base64 @@ -19,14 +19,14 @@ ok &request <= { - &Tmp-String-0 = "%(base64.encode:%{Tmp-String-0})" - &Tmp-String-1 = "%(base64.encode:%{Tmp-Octets-0})" - &Tmp-String-2 = "%(base64.encode:%{Tmp-IP-Address-0})" - &Tmp-String-4 = "%(base64.encode:%{Tmp-Integer-0})" - &Tmp-String-6 = "%(base64.encode:%{Tmp-Cast-Ifid})" - &Tmp-String-7 = "%(base64.encode:%{Tmp-Cast-IPv6Addr})" - &Tmp-String-8 = "%(base64.encode:%{Tmp-Cast-IPv6Prefix})" - &Tmp-String-9 = "%(base64.encode:%{Tmp-Cast-Byte})" + &Tmp-String-0 = %base64.encode(%{Tmp-String-0}) + &Tmp-String-1 = %base64.encode(%{Tmp-Octets-0}) + &Tmp-String-2 = %base64.encode(%{Tmp-IP-Address-0}) + &Tmp-String-4 = %base64.encode(%{Tmp-Integer-0}) + &Tmp-String-6 = %base64.encode(%{Tmp-Cast-Ifid}) + &Tmp-String-7 = %base64.encode(%{Tmp-Cast-IPv6Addr}) + &Tmp-String-8 = %base64.encode(%{Tmp-Cast-IPv6Prefix}) + &Tmp-String-9 = %base64.encode(%{Tmp-Cast-Byte}) } # String - bin 0x39383730 @@ -70,10 +70,10 @@ if (!(&Tmp-String-9[0] == 'Og==')) { } &request <= { - &Tmp-String-0 = "%(base64.encode:%{Tmp-Cast-Short})" - &Tmp-String-1 = "%(base64.encode:%{Tmp-Cast-Ether})" - &Tmp-String-2 = "%(base64.encode:%{Tmp-Cast-Integer64})" - &Tmp-String-3 = "%(base64.encode:%{Tmp-Cast-IPv4Prefix})" + &Tmp-String-0 = %base64.encode(%{Tmp-Cast-Short}) + &Tmp-String-1 = %base64.encode(%{Tmp-Cast-Ether}) + &Tmp-String-2 = %base64.encode(%{Tmp-Cast-Integer64}) + &Tmp-String-3 = %base64.encode(%{Tmp-Cast-IPv4Prefix}) } # short - bin 0x373b @@ -97,8 +97,8 @@ if (!(&Tmp-String-3[0] == 'IDk4Nz4=')) { } &request <= { - &Tmp-Octets-0 = "%(base64.decode:Zm9v)" - &Tmp-Octets-1 = "%(base64.decode:AIAAAAAAAAAAAAAAAAA5ODc5)" + &Tmp-Octets-0 = %base64.decode(Zm9v) + &Tmp-Octets-1 = %base64.decode(AIAAAAAAAAAAAAAAAAA5ODc5) } if (!(&Tmp-Octets-0 == "foo")) { @@ -112,14 +112,14 @@ if (!(&Tmp-Octets-1 == 0x008000000000000000000000000039383739)) { # Regression tests &request -= &Tmp-Octets-0[*] -&Tmp-Octets-0 := %(base64.decode:5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK) +&Tmp-Octets-0 := %base64.decode(5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK) if (!(&Tmp-Octets-0 == 0xe5136a365f2260b6e409cec9851f1ab384ed0c3097ea8b6eb96b5c8daf2b213532c7dceb9c749ef6d4c71a628a)) { test_fail } &request -= &Tmp-Octets-0[*] -&Tmp-Octets-0 = "%(base64.decode:eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=)" +&Tmp-Octets-0 = %base64.decode(eHfXPKZ+2iv9cnMV1MOmE/moYYA1Uk5xTmw4aVlMYmtDYzdKaFI4YXM0VHRERENYNm90dXVXdGNqYThySVRVeXg5enJuSFNlOXRUSEdtS0s=) if (!(&Tmp-Octets-0 == 0x7877d73ca67eda2bfd727315d4c3a613f9a8618035524e714e6c3869594c626b4363374a685238617334547444444358366f7475755774636a6138724954557978397a726e48536539745448476d4b4b)) { test_fail diff --git a/src/tests/keywords/concat b/src/tests/keywords/concat index 5c5fd023950..7edebc648ac 100644 --- a/src/tests/keywords/concat +++ b/src/tests/keywords/concat @@ -16,7 +16,7 @@ ok # separate updates &control += { - &Tmp-String-1 = "%(concat:%{control.[*]} ', ')" + &Tmp-String-1 = %concat(%{control.[*]}, ', ') } "%{control.Tmp-String-1}" @@ -25,7 +25,7 @@ if (!(&control.Tmp-String-1 == "bob, hello, ab c, de fg, 123")) { } &control += { - &Tmp-String-2 = "%(concat:%{control.Tmp-String-0[*]} ', ')" + &Tmp-String-2 = %concat(%{control.Tmp-String-0[*]}, ', ') } if (!(&control.Tmp-String-2 == "ab c, de fg")) { @@ -34,7 +34,7 @@ if (!(&control.Tmp-String-2 == "ab c, de fg")) { # Empty separator &control += { - &Tmp-String-3 = "%(concat:%{control.Tmp-String-0[*]})" + &Tmp-String-3 = %concat(%{control.Tmp-String-0[*]}) } if (!(&control.Tmp-String-3 == "ab cde fg")) { @@ -43,7 +43,7 @@ if (!(&control.Tmp-String-3 == "ab cde fg")) { # Single character separator &control += { - &Tmp-String-4 = "%(concat:%{control.Tmp-String-0[*]} ,)" + &Tmp-String-4 = %concat(%{control.Tmp-String-0[*]}, ',') } if (!(&control.Tmp-String-4 == "ab c,de fg")) { @@ -52,7 +52,7 @@ if (!(&control.Tmp-String-4 == "ab c,de fg")) { # Multi character separator not delimited &control += { - &Tmp-String-5 = "%(concat:%{control.Tmp-String-0[*]} |-)" + &Tmp-String-5 = %concat(%{control.Tmp-String-0[*]}, '|-') } if !(&control.Tmp-String-5 == "ab c|-de fg") { diff --git a/src/tests/keywords/date b/src/tests/keywords/date index 5422a9b2d15..3207c77548f 100644 --- a/src/tests/keywords/date +++ b/src/tests/keywords/date @@ -6,7 +6,7 @@ &Tmp-Integer-0 := 1506101100 # Convert to string representation -&Tmp-String-0 := %(date:%{Tmp-Integer-0}) +&Tmp-String-0 := %date(%{Tmp-Integer-0}) # Some systems report GMT some UTC... if (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 UTC 2017")) { @@ -14,15 +14,15 @@ if (!(&Tmp-String-0 == "Fri 22 Sep 17:25:00 GMT 2017")) && (!(&Tmp-String-0 == " } # Convert string to integer -&Tmp-Integer-1 := %(integer:%(date:%{Tmp-String-0})) +&Tmp-Integer-1 := %integer(%date(%{Tmp-String-0})) if (!(&Tmp-Integer-1 == &Tmp-Integer-0)) { test_fail } # Compare two methods of reading request timestamp in local timezone -&Tmp-String-0 := %(localdate:request) -&Tmp-String-1 := "%S" +&Tmp-String-0 := %localdate(request) +&Tmp-String-1 := %S if (!(&Tmp-String-0 == &Tmp-String-1)) { test_fail @@ -31,7 +31,7 @@ if (!(&Tmp-String-0 == &Tmp-String-1)) { # Convert different string format &Tmp-String-2 := "2017-09-22 17:25:00" -&Tmp-Integer-2 := %(integer:%(sqldate:%{Tmp-String-2})) +&Tmp-Integer-2 := %integer(%sqldate(%{Tmp-String-2})) if (!(&Tmp-Integer-2 == &Tmp-Integer-0)) { test_fail @@ -39,7 +39,7 @@ if (!(&Tmp-Integer-2 == &Tmp-Integer-0)) { # Use a date attribute &Tmp-Date-0 := 1659985459 -&Tmp-String-2 := "%(sqldate:%{Tmp-Date-0})" +&Tmp-String-2 := %sqldate(%{Tmp-Date-0}) if !(&Tmp-String-2 == '2022-08-08 19:04:19') { test_fail @@ -47,7 +47,7 @@ if !(&Tmp-String-2 == '2022-08-08 19:04:19') { # Invalid format &Tmp-String-3 := '201-32-22 17:25:00' -&Tmp-String-4 := %(sqldate:%{Tmp-String-3}) +&Tmp-String-4 := %sqldate(%{Tmp-String-3}) # This shouldn't exist, as the RHS above is NULL, and therefore the assignment will fail if (&Tmp-String-4) { @@ -60,7 +60,7 @@ if (!(&Module-Failure-Message == "Failed to parse time string \"201-32-22 17:25: # Invalid type &NAS-IP-Address := "192.168.1.1" -&Tmp-String-5 := %(date:%{NAS-IP-Address}) +&Tmp-String-5 := %date(%{NAS-IP-Address}) if (&Tmp-String-5) { test_fail diff --git a/src/tests/keywords/debug b/src/tests/keywords/debug index f0037a36faf..66028d9d8db 100644 --- a/src/tests/keywords/debug +++ b/src/tests/keywords/debug @@ -2,30 +2,30 @@ # PRE: if # -&Tmp-Integer-0 := "%(debug:4)" +&Tmp-Integer-0 := "%debug(4)" # Check debug level is now 4 -if (!("%(debug:3)" == 4)) { +if (!(%debug(3) == 4)) { test_fail } # Call with NULL arg, should report current level -if (!("%(debug:%{Tmp-String-8})" == 3)) { +if (!(%debug(%{Tmp-String-8}) == 3)) { test_fail } # ...and again -if (!("%(debug:%{Tmp-String-8})" == 3)) { +if (!(%debug(%{Tmp-String-8}) == 3)) { test_fail } # ...and again -if (!("%(debug:)" == 3)) { +if (!(%debug() == 3)) { test_fail } # ...and again -if (!("%(debug:)" == 3)) { +if (!(%debug() == 3)) { test_fail } diff --git a/src/tests/keywords/immutable b/src/tests/keywords/immutable index af95e6d415d..aa269413196 100644 --- a/src/tests/keywords/immutable +++ b/src/tests/keywords/immutable @@ -16,7 +16,7 @@ if !(&NAS-Port == 1813) { # # Mark it as immutable. The value shouldn't change. # -%(immutable:&request.NAS-Port[*]) +%immutable(&request.NAS-Port[*]) if !(&NAS-Port == 1813) { test_fail } diff --git a/src/tests/keywords/length b/src/tests/keywords/length index 5f911f32593..eacec187912 100644 --- a/src/tests/keywords/length +++ b/src/tests/keywords/length @@ -20,20 +20,20 @@ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' &Tmp-Cast-IPv4Prefix = 57.56.55.62/32 } -if (!(%(length:%{Tmp-String-0}) == 260)) { +if (!(%length(%{Tmp-String-0}) == 260)) { test_fail } &request += { - &Tmp-uint64-0 = "%(length:%{Tmp-String-2})" # Tmp-Integer-0 is defined and used below for Tmp-Integer-4 - &Tmp-Integer-1 = "%(length:%{Tmp-Octets-0})" - &Tmp-Integer-2 = "%(length:%{Tmp-IP-Address-0})" - &Tmp-Integer-3 = "%(length:\"hello, world\")" - &Tmp-Integer-4 = "%(length:%{Tmp-Integer-0})" - &Tmp-Integer-6 = "%(length:%{Tmp-Cast-Ifid})" - &Tmp-Integer-7 = "%(length:%{Tmp-Cast-IPv6Addr})" - &Tmp-Integer-8 = "%(length:%{Tmp-Cast-IPv6Prefix})" - &Tmp-Integer-9 = "%(length:%{Tmp-Cast-Byte})" + &Tmp-uint64-0 = %length(%{Tmp-String-2}) # Tmp-Integer-0 is defined and used below for Tmp-Integer-4 + &Tmp-Integer-1 = %length(%{Tmp-Octets-0}) + &Tmp-Integer-2 = %length(%{Tmp-IP-Address-0}) + &Tmp-Integer-3 = %length('hello, world') + &Tmp-Integer-4 = %length(%{Tmp-Integer-0}) + &Tmp-Integer-6 = %length(%{Tmp-Cast-Ifid}) + &Tmp-Integer-7 = %length(%{Tmp-Cast-IPv6Addr}) + &Tmp-Integer-8 = %length(%{Tmp-Cast-IPv6Prefix}) + &Tmp-Integer-9 = %length(%{Tmp-Cast-Byte}) } # String - bin 0x39383730 @@ -81,10 +81,10 @@ if (!(&Tmp-Integer-9 == 1)) { test_fail } -&Tmp-Integer-0 := "%(length:%{Tmp-Cast-Short})" -&Tmp-Integer-1 := "%(length:%{Tmp-Cast-Ether})" -&Tmp-Integer-2 := "%(length:%{Tmp-Cast-Integer64})" -&Tmp-Integer-3 := "%(length:%{Tmp-Cast-IPv4Prefix})" +&Tmp-Integer-0 := %length(%{Tmp-Cast-Short}) +&Tmp-Integer-1 := %length(%{Tmp-Cast-Ether}) +&Tmp-Integer-2 := %length(%{Tmp-Cast-Integer64}) +&Tmp-Integer-3 := %length(%{Tmp-Cast-IPv4Prefix}) # short - bin 0x373b if (!(&Tmp-Integer-0 == 2)) { diff --git a/src/tests/keywords/mschap b/src/tests/keywords/mschap index 47690e6ba44..2ad8e84146b 100644 --- a/src/tests/keywords/mschap +++ b/src/tests/keywords/mschap @@ -14,10 +14,10 @@ } &request += { - &Tmp-Octets-0 = %(mschap:Challenge) - &Tmp-Octets-1 = %(mschap:NT-Response) - &Tmp-String-0 = "%(mschap:NT-Domain)" - &Tmp-String-1 = "%(mschap:User-Name)" + &Tmp-Octets-0 = %mschap(Challenge) + &Tmp-Octets-1 = %mschap(NT-Response) + &Tmp-String-0 = %mschap(NT-Domain) + &Tmp-String-1 = %mschap(User-Name) } if !(&Tmp-Octets-0 == 0xe96e4fff2955c4f1) { @@ -38,15 +38,15 @@ if !(&Tmp-String-1 == 'bob') { &request.Vendor-Specific.Microsoft.CHAP-Response := 0x00006937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db158860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f -&Tmp-Octets-0 := "%(mschap:LM-Response)" +&Tmp-Octets-0 := %mschap(LM-Response) if !(&Tmp-Octets-0 == 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) { test_fail } # Hashing -&Tmp-Octets-0 := %(mschap:NT-Hash testing_123) -&Tmp-Octets-1 := %(mschap:LM-Hash testing_123) +&Tmp-Octets-0 := %mschap(NT-Hash, 'testing_123') +&Tmp-Octets-1 := %mschap(LM-Hash, 'testing_123') if !(&Tmp-Octets-0 == 0xfa782604f85eb3564f555648341b53e4) { test_fail @@ -62,8 +62,8 @@ if !(&Tmp-Octets-1 == 0x2d5545077d7b7d2ae4343f96ab15c596) { &Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e &Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200 -&Tmp-Octets-0 := %(mschap:Challenge) -&Tmp-Octets-1 := %(mschap:NT-Response) +&Tmp-Octets-0 := %mschap(Challenge) +&Tmp-Octets-1 := %mschap(NT-Response) if !(&Tmp-Octets-0 == 0xad18b6b8e1478b4c) { test_fail @@ -75,9 +75,9 @@ if !(&Tmp-Octets-1 == 0xbc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b2) { # Invalid &Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428 -&Tmp-String-0 := "%(mschap:Challenge)" +&Tmp-String-0 := %mschap(Challenge) -if !(&Tmp-String-0 == "") { +if (&Tmp-String-0) { test_fail }