]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more "convert to edit"
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Aug 2022 22:55:05 +0000 (18:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 5 Aug 2022 14:19:19 +0000 (10:19 -0400)
19 files changed:
src/tests/keywords/map-2arg-error
src/tests/keywords/map-csv-prepend
src/tests/keywords/map-xlat
src/tests/keywords/map-xlat-nested
src/tests/keywords/map-xlat-nested-overwrite
src/tests/keywords/map-xlat-struct
src/tests/keywords/md4
src/tests/keywords/md5
src/tests/keywords/md5-error
src/tests/keywords/module-action-error
src/tests/keywords/module-action-ok
src/tests/keywords/module-failure-message
src/tests/keywords/mschap
src/tests/keywords/nexttime
src/tests/keywords/notfound
src/tests/keywords/ok-return
src/tests/keywords/pack
src/tests/keywords/pad
src/tests/keywords/parallel

index df2221d7a1d27d58ce8644ef963e8c7441ad3e85..530063792847b5645a5ac860e9fa04ad691ab5c1 100644 (file)
@@ -1,6 +1,3 @@
-#
-#  PRE: update
-#
 map foo {      # ERROR
     User-Name = 'foo'
 }
index e3e3bd5f54c9076c64b108e0db0447cbe8f0fad2..b83755737e8aa4941324767072693c719a8b4090 100644 (file)
@@ -1,10 +1,8 @@
 #
-#  PRE: update map
+#  PRE: map
 #
 
-update control {
-       &Tmp-String-0 := "fail"
-}
+&control.Tmp-String-0 := "fail"
 
 map csv &User-Name {
        &control.Tmp-String-0 ^= 'field3'
index 884a7bf5599efa66f8106b939cdddb45ded0be06..0cb53f48dfe99dcd30a6a5ca18c7bd33d48332b1 100644 (file)
@@ -1,12 +1,12 @@
 #
-# PRE: update
+# PRE: map foreach
 #
 #  Test the map xlat
 #
-update {
-       &Tmp-String-0 := '&control.Tmp-String-0 := \'testing123\''
-       &Tmp-String-1 := "request.Vendor-Specific.Nokia-SR.MSAP-Interface = 'UNICAST_7360OLT3'"
-       &Tmp-String-1 += "request.Vendor-Specific.Nokia-SR.MSAP-Interface += 'UNICAST_7360OLT4'"
+&request += {
+       &Tmp-String-0 = '&control.Tmp-String-0 := \'testing123\''
+       &Tmp-String-1 = "request.Vendor-Specific.Nokia-SR.MSAP-Interface = 'UNICAST_7360OLT3'"
+       &Tmp-String-1 = "request.Vendor-Specific.Nokia-SR.MSAP-Interface += 'UNICAST_7360OLT4'"
 }
 
 if ("%{map:%{Tmp-String-0}}" != 1) {
index 379385168b317e7c9cec5ad4222c5c46b780f7c8..e2f4242601d702bb8dc63e3148e25ac22ef47ddc 100644 (file)
@@ -1,11 +1,9 @@
 #
-# PRE: update
+# PRE: map-xlat
 #
 #  Test the map xlat
 #
-update {
-       &Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-1 = 'testing123'"
-}
+&Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-1 = 'testing123'"
 
 if ("%{map:%{Tmp-String-0}}" != 1) {
        test_fail
index 505ea2474cbc08bc939fb703e74822625c841f32..9d23ad17f1487f59cf1e7a36e4739344d6687356 100644 (file)
@@ -1,11 +1,9 @@
 #
-# PRE: update
+# PRE: map-xlat
 #
 #  Test the map xlat
 #
-update {
-       &Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-0 := 'testing123'"
-}
+&Tmp-String-0 := "request.Tmp-Group-0.Tmp-String-0 := 'testing123'"
 
 if ("%{map:%{Tmp-String-0}}" != 1) {
        test_fail
index fb0fbe041e390467cc6b9d386beaf63e39e6f780..664f3781cb38dd042b4492e706f929ec80b00c53 100644 (file)
@@ -1,12 +1,10 @@
 #
-# PRE: update
+# PRE: map
 # PROTOCOL: dhcpv6
 #
 #  Test the map xlat
 #
-update {
-       &Tmp-String-0 := "IA-PD.IAID = 11"
-}
+&Tmp-String-0 := "IA-PD.IAID = 11"
 
 if ("%{map:%{Tmp-String-0}}" != 1) {
        test_fail
index 91a4a80a8e484ee2cf91f9e818469b1fbe0b04ae..b6cef289bd6e80ca4947005dbe32eab4ecd80c54 100644 (file)
@@ -1,21 +1,21 @@
 #
-# PRE: update if
-#
-update {
-       &request.Tmp-String-0 := "This is a string\n"
-       &request.Tmp-Octets-0 := 0x000504030201
-       &request.Tmp-String-1 := "what do ya want for nothing?"
-       &request.Tmp-String-2 := "Jefe"
-       &request.Tmp-String-3 := ""
+# PRE: if
+#
+&request += {
+       &Tmp-String-0 = "This is a string\n"
+       &Tmp-Octets-0 = 0x000504030201
+       &Tmp-String-1 = "what do ya want for nothing?"
+       &Tmp-String-2 = "Jefe"
+       &Tmp-String-3 = ""
 }
 
 
-update request {
-        &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}}"
-        &Tmp-Octets-5           := "%{md4:%{Tmp-String-9}}"
+&request += {
+        &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}}"
+        &Tmp-Octets-5 = "%{md4:%{Tmp-String-9}}"
 }
 
 #
index d2b523d295349ba4949bfb0b534460a7d951d222..fda682a5b62a7ff4f3d7153ba5ea48b7ed9029b8 100644 (file)
@@ -1,23 +1,23 @@
 #
-# PRE: update if
+# PRE: if
 #
-update {
-       &request.Tmp-String-0 := "This is a string\n"
-       &request.Tmp-Octets-0 := 0x000504030201
-       &request.Tmp-String-1 := "what do ya want for nothing?"
-       &request.Tmp-String-2 := "Jefe"
-       &request.Tmp-String-3 := ""
+&request += {
+       &Tmp-String-0 = "This is a string\n"
+       &Tmp-Octets-0 = 0x000504030201
+       &Tmp-String-1 = "what do ya want for nothing?"
+       &Tmp-String-2 = "Jefe"
+       &Tmp-String-3 = ""
 }
 
 
-update request {
-        &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}}"
-        &Tmp-Octets-5           := "%{md5:%{Tmp-String-9}}"
-        &Tmp-Octets-6           := "%(hmacmd5:%{Tmp-String-1} %{Tmp-String-2})"
-        &Tmp-Octets-7           := "%(hmacmd5:%{Tmp-String-3} %{Tmp-String-3})"
+&request += {
+        &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}}"
+        &Tmp-Octets-5 = "%{md5:%{Tmp-String-9}}"
+        &Tmp-Octets-6 = "%(hmacmd5:%{Tmp-String-1} %{Tmp-String-2})"
+        &Tmp-Octets-7 = "%(hmacmd5:%{Tmp-String-3} %{Tmp-String-3})"
 }
 
 #
index 25ff43b1ab3ce4d6609d42991008d49cc1d9304e..f04f980ea8b25e6d374d5df4a2f5bd76e1e8abba 100644 (file)
@@ -1,16 +1,12 @@
 #
-# PRE: update
+# PRE: md5
 #
 
-update request {
-        &Tmp-String-1 := "hello"
-}
+&Tmp-String-1 := "hello"
 
 #
 #  MD5 HMAC with missing key should fail
 #
-update request {
-        &Tmp-Octets-1 := "%(hmacmd5:%{Tmp-String-1} )" # ERROR
-}
+&Tmp-Octets-1 := "%(hmacmd5:%{Tmp-String-1} )" # ERROR
 
 test_fail
index 0022d36f8fac47f255eb3eaec1132276767f5afc..3753f8f9eb44167f407966105aa9122c2e9f9098 100644 (file)
@@ -1,5 +1,5 @@
 #
-# PRE: update ok-return
+# PRE: ok-return
 #
 
 ok {
index 63176ce94e3407a2c240071fb0136973e018e95e..424297175cb0027cc7e06cec0d9ed133a2f0c716 100644 (file)
@@ -1,5 +1,5 @@
 #
-# PRE: update ok-return
+# PRE: ok-return
 #
 
 ok {
index 6c787e730826ca48e268cac5ec13049c872a2c6f..c528e876b63787ac3d89f71af54b28a46c0a391b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# PRE: update
+# PRE: if
 #
 
 test
index bcceaf6d58f6d6da8dabc121ed2ef21d9e6ba72b..3bb2a9730f0bcd90eff5c381fcdbe09badaee1d3 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  PRE: update
+#  PRE: if
 #
 
 # MS CHAPv1
@@ -9,11 +9,11 @@ update request {
        &Vendor-Specific.Microsoft.CHAP-Response := 0x00010000000000000000000000000000000000000000000000008860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f
 }
 
-update request {
-        &Tmp-Octets-0 := "%(mschap:Challenge)"
-        &Tmp-Octets-1 := "%(mschap:NT-Response)"
-        &Tmp-String-0 := "%(mschap:NT-Domain)"
-        &Tmp-String-1 := "%(mschap:User-Name)"
+&request += {
+        &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) {
index b8e64e738574c6e0c90f20865c2f4d5243be237d..7b93dfc169b87b2d6fb55b254b8d93e1f78e42c1 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  PRE: update expr
+#  PRE: expr
 #
 
 #
@@ -7,27 +7,25 @@
 #  different numbers of days involved.  Check hour / day / week
 #
 
-update request {
-        &Tmp-Integer-0 := "%{expr:%(nexttime:2h) - %(nexttime:1h)}"
-}
+&Tmp-Integer-0 := "%{expr:%(nexttime:2h) - %(nexttime:1h)}"
 
 # We have a fudge factor of 1 second either way
 if ((&Tmp-Integer-0 < 3599) || (&Tmp-Integer-0 > 3601)) {
         test_fail
 }
 
-update request {
-        &Tmp-Integer-0 := "%{expr:%(nexttime:3d) - %(nexttime:1d)}"
-}
-
+#
+#  Day
+#
+&Tmp-Integer-0 := "%{expr:%(nexttime:3d) - %(nexttime:1d)}"
 if ((&Tmp-Integer-0 < 172799) || (&Tmp-Integer-0 > 172801)) {
         test_fail
 }
 
-update request {
-        &Tmp-Integer-0 := "%{expr:%(nexttime:4w) - %(nexttime:2w)}"
-}
-
+#
+#  Week
+#
+&Tmp-Integer-0 := "%{expr:%(nexttime:4w) - %(nexttime:2w)}"
 if ((&Tmp-Integer-0 < 1209599) || (&Tmp-Integer-0 > 1209601)) {
         test_fail
 }
index e617fe2d844bc62e5b5eff2dce361eb016d92007..169e90082c318a5f3b721e2064365d5e8e52a564 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  PRE: if update
+#  PRE: if
 #
 
 #
index 90afe25bf333f672ef0b29118b558e01fce55e83..9262160dca6f240ba64664bd2c0ae004cc3b39d4 100644 (file)
@@ -1,13 +1,13 @@
-update {
-       &control.Auth-Type = 'Accept'
-       &reply.Reply-Message = 'pass'
-}
+&control.Auth-Type := 'Accept'
+&reply.Reply-Message := 'pass'
+
 
 # Section should exit after this statement
 ok {
        ok = return
 }
 
-update {
-       &reply.Reply-Message := 'fail'
-}
+#
+#  If we hit this statement, that's an error.
+#
+test_fail
index 2b5079483d0cd7e40c1ed0314aa3322373facb0b..c4ac78b54dd26fc513d9be0b99a528aff50b8137 100644 (file)
@@ -1,12 +1,14 @@
-update request {
-       &Framed-IP-Address := 127.0.0.1
+#
+#  PRE: if
+#
+&request += {
+       &Framed-IP-Address = 127.0.0.1
        &NAS-Port = 2112
-       &NAS-IP-Address := 127.0.0.2
+       &NAS-IP-Address = 127.0.0.2
 }
 
-update request {
-       &Tmp-Octets-0 := "%{pack:%{Framed-IP-Address}%{NAS-Port}%{NAS-IP-Address}}"
-}
+
+&Tmp-Octets-0 := "%{pack:%{Framed-IP-Address}%{NAS-Port}%{NAS-IP-Address}}"
 
 if (&Tmp-Octets-0 != 0x7f000001000008407f000002) {
        fail
index 5fef6fe297b962b65e6419e3608f6ff6d1c39b7b..1ffebb7a84c60f53de8889d1799b7d15f02adf11 100644 (file)
@@ -1,10 +1,8 @@
 #
-#  PRE: if update return
+#  PRE: if return
 #
 
-update request {
-       &Tmp-String-0 = "test"
-}
+&Tmp-String-0 = "test"
 
 #
 #      rpad tests
index fe424019f875373f318f9853e112717351f9f2a3..d9af45c9b49d6a66660d1bcb39d845ef4ccc3dd3 100644 (file)
@@ -1,25 +1,37 @@
 #
-#  PRE: update
+#  PRE:
 #
 parallel {
-       update parent.control {
-              &Tmp-Integer-0 += 1
+       group {
+               &parent.control += {
+                       &Tmp-Integer-0 = 1
+               }
        }
-       update parent.control {
-              &Tmp-Integer-0 += 2
+       group {
+               &parent.control += {
+                       &Tmp-Integer-0 = 3
+               }
        }
-       update parent.control {
-              &Tmp-Integer-0 += 3
+       group {
+               &parent.control += {
+                       &Tmp-Integer-0 = 5
+               }
        }
-       update parent.control {
-              &Tmp-Integer-0 += 4
+       group {
+               &parent.control += {
+                       &Tmp-Integer-0 = 7
+               }
        }
 }
 
 if ("%{control.Tmp-Integer-0[#]}" != 4) {
        test_fail
-
-       return
 }
 
+#
+#  We can't check order, as there's offically no guarantee on the
+#  order in which child sections will be evaluated.
+#
+
+
 success