]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
auto-convert functions with fixed string arguments
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Oct 2023 13:09:33 +0000 (09:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 9 Oct 2023 13:09:33 +0000 (09:09 -0400)
perl -p -i -e "s/%{([a-zA-Z0-9._-]+):([^&%{}=']+)}/%\$1('\$2')/g"  $(git grep -lE '%\{[a-z0-9.-]+:' src/tests/keywords/ src/tests/modules)

src/tests/keywords/md4
src/tests/keywords/md5
src/tests/keywords/rand
src/tests/keywords/sha1
src/tests/modules/idn/idn.unlang
src/tests/modules/redis/module.conf
src/tests/modules/redis_ippool/module.conf
src/tests/modules/sql/groups.unlang

index 4f918e04bee6af27fe345d1ecaaf1145a1c7709f..fee3d6170c1f4f0655b1ae132e5346686353a9e8 100644 (file)
@@ -11,7 +11,7 @@
 
 
 &request += {
-       &Tmp-Octets-1 = "%{md4:This is a string\n}"
+       &Tmp-Octets-1 = "%md4('This is a string\n')"
        &Tmp-Octets-2 = "%{md4:%{Tmp-String-0}}"
        &Tmp-Octets-3 = "%{md4:%{request.Tmp-String-0}}"
        &Tmp-Octets-4 = "%{md4:%{request.Tmp-Octets-0}}"
index 38284b842ecfd094ad2bb0327e3b994ab95c1865..4fd20f5aa722c5b3b417d5535b3a04b3e83a2471 100644 (file)
@@ -11,7 +11,7 @@
 
 
 &request += {
-       &Tmp-Octets-1 = "%{md5:This is a string\n}"
+       &Tmp-Octets-1 = "%md5('This is a string\n')"
        &Tmp-Octets-2 = "%{md5:%{Tmp-String-0}}"
        &Tmp-Octets-3 = "%{md5:%{request.Tmp-String-0}}"
        &Tmp-Octets-4 = "%{md5:%{request.Tmp-Octets-0}}"
index 5d5441e8cc502ef5d1931d85f6947ee703eebd49..94b67e7699631ae79ac8dd31041e18cba976136e 100644 (file)
@@ -1,4 +1,4 @@
-&Tmp-String-0 := "%{rand:-1}"
+&Tmp-String-0 := "%rand('-1')"
 
 #
 #  Negative limit should have failed assignment
@@ -7,7 +7,7 @@ if !(&Tmp-String-0 == "") {
        test_fail
 }
 
-&Tmp-String-0 := "%{rand:hello world}"
+&Tmp-String-0 := "%rand('hello world')"
 
 #
 #  Invalid limit should have failed assignment
index 0630907c349b7bf1dbe37185190650d00b76a315..2dccd062d568469e1882db95e5c9a1ea3e8b811a 100644 (file)
@@ -10,7 +10,7 @@
 }
 
 &request += {
-       &Tmp-Octets-2 = "%{sha1:This is a string\n}"
+       &Tmp-Octets-2 = "%sha1('This is a string\n')"
        &Tmp-Octets-3 = "%{sha1:%{Tmp-String-0}}"
        &Tmp-Octets-4 = "%{sha1:%{request.Tmp-String-0}}"
        &Tmp-Octets-5 = "%{sha1:%{request.Tmp-Octets-9}}"
index 8ad069779878236bb860629b41671df194642fb8..1fe85afe9bb1f2195bdd4dffa7a3860366c7315d 100644 (file)
@@ -3,10 +3,10 @@
 #
 
 &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-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
@@ -28,7 +28,7 @@ if (&Tmp-String-4 != "xn--72c1a1bt4awk9o.com") {
         test_fail
 }
 
-&Tmp-String-0 := "%{idn:invalid_example.com}"
+&Tmp-String-0 := "%idn('invalid_example.com')"
 
 if (&Module-Failure-Message != "Non-digit/letter/hyphen in input") {
         test_fail
@@ -40,7 +40,7 @@ if (&Module-Failure-Message == "") {
 
 &request -= &Module-Failure-Message[*]
 
-&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}"
+&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
index fe644b5dedcd230517b81b087100bd7d1c8522b0..9d303b73b2c84c0807333444467327eb256d1d44 100644 (file)
@@ -4,7 +4,7 @@
 
 #
 #  Configuration file for the "redis" module.  This module does nothing
-#  Other than provide connections to a redis database, and a %{redis: ...}
+#  Other than provide connections to a redis database, and a %redis(' ...')
 #  expansion.
 #
 redis {
index 38f9951ff2f0f21897d95ec994f8969ccc7cef71..88a82699e19b17fc8df9a80aa34bce6c6fe8a4d6 100644 (file)
@@ -4,7 +4,7 @@
 
 #
 #  Configuration file for the "redis" module.  This module does nothing
-#  Other than provide connections to a redis database, and a %{redis: ...}
+#  Other than provide connections to a redis database, and a %redis(' ...')
 #  expansion.
 #
 redis_ippool {
index 7fb50139344e4694def68b02fa85efff878087cb..c5edca64bde5019e5aa7e92ca7a04a7ea7e3f4f7 100644 (file)
@@ -54,20 +54,20 @@ else {
 #
 #  Test paircmp group comparisons
 #
-if (%{sql.group:groups_group_a} != false) {
+if (%sql.group('groups_group_a') != false) {
        test_fail
 }
 
-if (%{sql.group:groups_group_b} != true) {
+if (%sql.group('groups_group_b') != true) {
        test_fail
 }
 
-if (%{sql.group:groups_group_c} != true) {
+if (%sql.group('groups_group_c') != true) {
        test_fail
 }
 
 # Non-existent group
-if (%{sql.group:groups_group_d} != false) {
+if (%sql.group('groups_group_d') != false) {
        test_fail
 }