]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More convert from 'update {....}' to 'edit' against src/tests/keywords (#4710)
authorJorge Pereira <jpereira@users.noreply.github.com>
Thu, 1 Sep 2022 20:21:46 +0000 (17:21 -0300)
committerGitHub <noreply@github.com>
Thu, 1 Sep 2022 20:21:46 +0000 (16:21 -0400)
src/tests/keywords/paircmp
src/tests/keywords/pap-ssha2
src/tests/keywords/radius.conf
src/tests/keywords/sha2
src/tests/keywords/truncation
src/tests/keywords/unknown

index c4a1f9c34e82baf5ff1efce1b0a701ab36e8af95..8c8cef0904d9e4739966b5281044fdb10c4e8ab0 100644 (file)
@@ -21,7 +21,6 @@ else {
 #
 if (&Test-Paircmp == &NAS-Identifier) {
        success
-
 }
 else {
        test_fail
index ce3b4b938e4aa568b83e16f5b582d2941c01d774..53ad8f2741bb28de4192058175ba9d6f3afeee78 100644 (file)
@@ -22,8 +22,8 @@ if ('${feature.tls}' != 'yes') {
 #
 #  Hex encoded SSHA2-512 password
 #
-update {
-       &control.Password.With-Header += "{ssha512}%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
+&control += {
+       &Password.With-Header = "{ssha512}%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
 }
 
 pap.authorize
@@ -39,22 +39,16 @@ if (reject) {
 #
 #  Base64 encoded SSHA2-512 password
 #
-update {
-       &control.Tmp-String-1 := "%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
-}
+&control.Tmp-String-1 := "%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
 
 # To Binary
-update {
-       &control.Tmp-Octets-0 := "%{bin:%{control.Tmp-String-1}}"
-}
+&control.Tmp-Octets-0 := "%{bin:%{control.Tmp-String-1}}"
 
 # To Base64
-update {
-       &control.Tmp-String-1 := "%{base64:%{control.Tmp-Octets-0}}"
-}
+&control.Tmp-String-1 := "%{base64:%{control.Tmp-Octets-0}}"
 
-update {
-       &control.Password.With-Header += "{ssha512}%{control.Tmp-String-1}"
+&control += {
+       &Password.With-Header = "{ssha512}%{control.Tmp-String-1}"
 }
 
 pap.authorize
@@ -70,22 +64,16 @@ if (reject) {
 #
 #  Base64 of Base64 encoded SSHA2-512 password
 #
-update {
-       &control.Tmp-String-1 := "%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
-}
+&control.Tmp-String-1 := "%{hex:%{sha2_512:%{User-Password}%{Tmp-String-0}}}%{hex:%{Tmp-String-0}}"
 
 # To Binary
-update {
-       &control.Tmp-Octets-0 := "%{bin:%{control.Tmp-String-1}}"
-}
+&control.Tmp-Octets-0 := "%{bin:%{control.Tmp-String-1}}"
 
 # To Base64
-update {
-       &control.Tmp-String-1 := "{ssha512}%{base64:%{control.Tmp-Octets-0}}"
-}
+&control.Tmp-String-1 := "{ssha512}%{base64:%{control.Tmp-Octets-0}}"
 
-update {
-       &control.Password.With-Header += "%{base64:%{control.Tmp-String-1}}"
+&control += {
+       &Password.With-Header = "%{base64:%{control.Tmp-String-1}}"
 }
 
 pap.authorize
@@ -101,9 +89,7 @@ if (reject) {
 #
 #  Base64 of SHA2-384 password (in SHA2-Password)
 #
-update control {
-       &control.Password.SHA2 := "%{hex:%{sha2_384:%{User-Password}}}"
-}
+&control.Password.SHA2 := "%{hex:%{sha2_384:%{User-Password}}}"
 
 pap.authorize
 pap.authenticate {
@@ -120,9 +106,7 @@ if (reject) {
 #
 #  Base64 of SHA2-256 password (in SHA2-256-Password)
 #
-update control {
-       &control.Password.SHA2-256 := "%{hex:%{sha2_256:%{User-Password}}}"
-}
+&control.Password.SHA2-256 := "%{hex:%{sha2_256:%{User-Password}}}"
 
 pap.authorize
 pap.authenticate {
@@ -137,9 +121,7 @@ if (reject) {
 #
 #  Base64 of SHA2-224 password (in SHA2-224-Password - No hex armour)
 #
-update control {
-       &control.Password.SHA2-224 := "%{sha2_224:%{User-Password}}"
-}
+&control.Password.SHA2-224 := "%{sha2_224:%{User-Password}}"
 
 pap.authorize
 pap.authenticate {
index 0e5a771a649e6583fee3107ac46f64482a90d59e..5283b2f04b639bfceee8c6087349560b53efec2f 100644 (file)
@@ -119,9 +119,7 @@ server default {
        }
 
        recv Access-Request {
-               update control {
-                       &Password.Cleartext := 'hello'
-               }
+               &control.Password.Cleartext := "hello"
 
                #
                # Include the test file specified by the
index c82bd44f4e868c610270a1752a3cbcd173901181..029eaa8b90bd9ee8d90424374ab1c0bf927cea7b 100644 (file)
@@ -1,18 +1,14 @@
 #
 # PRE: update if
 #
-update {
-       &request.Tmp-String-0 := "This is a string\n"
-       &request.Tmp-Octets-0 := 0x000504030201
-}
+&request.Tmp-String-0 := "This is a string\n"
+&request.Tmp-Octets-0 := 0x000504030201
 
-update {
-       &request.Tmp-Octets-1 := "%{sha2_256:This is a string\n}"
-       &request.Tmp-Octets-2 := "%{sha2_256:%{Tmp-String-0}}"
-       &request.Tmp-Octets-3 := "%{sha2_256:%{request.Tmp-String-0}}"
-       &request.Tmp-Octets-4 := "%{sha2_256:%{request.Tmp-Octets-0}}"
-       &request.Tmp-Octets-5 := "%{sha2_256:%{request.Tmp-Octets-9}}"
-}
+&request.Tmp-Octets-1 := "%{sha2_256:This is a string\n}"
+&request.Tmp-Octets-2 := "%{sha2_256:%{Tmp-String-0}}"
+&request.Tmp-Octets-3 := "%{sha2_256:%{request.Tmp-String-0}}"
+&request.Tmp-Octets-4 := "%{sha2_256:%{request.Tmp-Octets-0}}"
+&request.Tmp-Octets-5 := "%{sha2_256:%{request.Tmp-Octets-9}}"
 
 #
 #  Put "This is a string" into a file and call "sha2_256sum" on it.
@@ -48,11 +44,9 @@ if (&request.Tmp-Octets-5 != 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca
 #  SHA512 and SHA256 share common code paths, so the tests don't need to be
 #  as exhaustive.
 #
-update {
-       &request.Tmp-Octets-1 := "%{sha2_512:This is a string\n}"
-       &request.Tmp-Octets-2 := "%{sha2_512:%{Tmp-String-0}}"
-       &request.Tmp-Octets-3 := "%{sha2_512:%{request.Tmp-Octets-0}}"
-}
+&request.Tmp-Octets-1 := "%{sha2_512:This is a string\n}"
+&request.Tmp-Octets-2 := "%{sha2_512:%{Tmp-String-0}}"
+&request.Tmp-Octets-3 := "%{sha2_512:%{request.Tmp-Octets-0}}"
 
 if (&request.Tmp-Octets-1 != 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f) {
        test_fail
index dd6fc0b96a8e2936541453dba406639ae246ab0b..bd52e37d17276f31ec3e01f6cbc27c2a993cb8c7 100644 (file)
@@ -1,8 +1,7 @@
 # cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c <n>
 
 # 8192 - 0x (2) - '' (2) there are unlikely to be any static buffers this big outside of the conffile parser
-update request {
-       &Tmp-Octets-0 := 0x\
+&Tmp-Octets-0 := 0x\
 d8abccb7834711af1de1812be2579febe946f5d7beef6fa5c7074c0cb917e9b91e23e14b016f27610097c16c0e0fad88176e077b24198c770746159\
 05b8810d1c8b774d98889fa5c6027cde5e9c56dd4f7c48298c7713aeca5ba5dcfd506032ad05b1396f50e825b633d5a6af0dce6181b640287e03a65\
 8734df46a86341556f28455b3f377313a5a2ac8c8267b8a5de559b95f9b493a68b9e0278485f9e3914d702b2b7b90ee85ff393461f197386d09b836\
@@ -72,7 +71,6 @@ fc813bd2e58c6d0dfd951570dbff4b5e73ce547cd100ab320b6944e887d611b3425bfcdf3bfa852f
 fc6afab4c5dd4aae4a2e6f0293c15278d557c2925acba90c73eeea09ebb95f0d469aa77ae983a0e69dacd55bd8a7e78a41df5227de35af05127fa3b\
 a02f4a3ab98d75992d68a15d393387fe9ef01041569570ad6fe884764e55567311bcacfcffae76554dcfebfde607500f50ec85f589eaade607500f5\
 3ae4bcef324b9a3f47ba5c835b54a010ca42f3b9cc5368278c148c9b02ea8c4c9f244fd49f
-}
 
 # Actual length of octet string is 4083 bytes
 if (%(length:%{Tmp-Octets-0}) != 4083) {
index a9bf0cb3fec6ba0f4e1cb5c0f28a7d42ad978bd5..edd40f54e1a75598d80faedffe3e5af3bc911f97 100644 (file)
@@ -8,9 +8,7 @@ update request {
 #
 #  Check that a known but malformed attr is malformed
 #
-update request {
-       &26.24757.84.9.5.7 = 0xab
-}
+&request.26.24757.84.9.5.7 := 0xab
 
 if (&26.24757.84.9.5.7 != 0xab) {
        test_fail
@@ -19,9 +17,7 @@ if (&26.24757.84.9.5.7 != 0xab) {
 #
 #  Check that an unknown attr is OK
 #
-update request {
-       &26.24757.84.9.5.15 = 0xabcdef
-}
+&request.26.24757.84.9.5.15 := 0xabcdef
 
 if (&26.24757.84.9.5.15 != 0xabcdef) {
        test_fail
@@ -39,9 +35,7 @@ if (&26.11344.1 != 127.0.0.2) {
        test_fail
 }
 
-update request {
-       &26.11344.1 := 0x7f000001
-}
+&request.26.11344.1 := 0x7f000001
 
 if (&Vendor-Specific.FreeRADIUS.Proxied-To == 127.0.0.2) {
        test_fail
@@ -59,9 +53,7 @@ if (&26.11344.1 != 127.0.0.1) {
        test_fail
 }
 
-update request {
-       &26.66.1 = 0x01020304
-}
+&request.26.66.1 = 0x01020304
 
 if (&26.66.1 != 0x01020304) {
        test_fail