]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more xlat cleanups
authorAlan T. DeKok <aland@freeradius.org>
Fri, 5 Jan 2024 14:29:35 +0000 (09:29 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 5 Jan 2024 15:06:49 +0000 (10:06 -0500)
src/tests/modules/cipher/serial.unlang
src/tests/modules/eap_sim/sim_xlat_id_aka_decrypt_no_tag.unlang
src/tests/modules/exec/sync.unlang
src/tests/modules/unbound/dns.unlang

index c70b069f9f016a2fe80ac77d9389ac262872c545..c49920ae2bd06318c5760dbc66d455ff8527bdee 100644 (file)
@@ -1,4 +1,4 @@
-&Tmp-Octets-0 := "%(cipher_rsa.certificate:serial)"
+&Tmp-Octets-0 := %cipher_rsa.certificate('serial')
 
 if (%length(%{Tmp-Octets-0}) != 1) {
        test_fail
index db4dd87803c8fedb80c84a8e0a0228d5ae5e4810..43d8c746d448c9eeb483d07fd8750baef6e2ac49 100644 (file)
@@ -15,7 +15,7 @@ if (%aka_sim_id_type(%{User-Name}) != 'permanent') {
 #
 #  1.2 - Get the original IMSI back again sans tag
 #
-&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}")) {
index 3fd6167c69a6c87b985b34dbe869c9693392c042..1fa17147fb0c20a0c09ffb9b7cfd7f6bb7bc0ed4 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Sync calls return the response
 #
-&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
 }
@@ -10,20 +10,24 @@ if (&Tmp-String-0 != 'hello') {
 #  Call something which will take longer than the timeout
 #
 &request -= &Tmp-String-0
-&Tmp-String-0 := "%(exec_sync:/bin/sleep 10)"
+&request -= &Module-Failure-Message
 
-if (&Module-Failure-Message[*] != "Execution of external program failed: Timeout running program") {
+&Tmp-String-0 := %exec_sync('/bin/sleep', '10')
+
+if (&Module-Failure-Message != "Execution of external program failed: Timeout running program") {
        test_fail
 }
 
-if !(&Tmp-String-0 == "") {
+if &Tmp-String-0  {
        test_fail
 }
 
 &request -= &Tmp-String-0
-&Tmp-String-0 := "%(exec_sync:/bin/sh $ENV{MODULE_TEST_DIR}/fail.sh)"
+&request -= &Module-Failure-Message
+
+&Tmp-String-0 := %exec_sync('/bin/sh', "$ENV{MODULE_TEST_DIR}/fail.sh")
 
-if !(&Tmp-String-0 == "") {
+if &Tmp-String-0 {
        test_fail
 }
 
index a91f20af033b7ad1fcb3f4117308eb72212f6a7a..bee7dc199cbbde9260980d667a28d04501065181 100644 (file)
@@ -5,20 +5,20 @@ if (&Tmp-IP-Address-0 != 127.0.0.1) {
        test_fail
 }
 
-&Tmp-String-0 := "%(dns:localhost AAAA)"
+&Tmp-String-0 := %dns('localhost', 'AAAA')
 
 if (&Tmp-String-0 != "::1") {
        test_fail
 }
 
-&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
-&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
@@ -32,27 +32,27 @@ if (&Tmp-String-0 != "www.example.com") {
 
 # Try a real, known, network response
 # Temporarily disabled while there is a bug in unbound
-#&Tmp-String-0 := %dns(8.8.8.8.in-addr.arpa,PTR)
+#&Tmp-String-0 := %dns('8.8.8.8.in-addr.arpa', 'PTR')
 
 #if (&Tmp-String-0 != "dns.google") {
 #      test_fail
 #}
 
 # Invalid query
-&Tmp-String-0 := %dns(www.example.com,ABC)
+&Tmp-String-0 := %dns('www.example.com', 'ABC')
 
 if (&Module-Failure-Message != "Invalid / unsupported DNS query type") {
        test_fail
 }
 
 &Tmp-String-0 := ""
-&Tmp-String-1 := %dns(%{Tmp-String-0},A)
+&Tmp-String-1 := %dns(%{Tmp-String-0}, 'A')
 
 if (&Module-Failure-Message != "Can't resolve zero length host") {
        test_fail
 }
 
-&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