]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more "convert update"
authorAlan T. DeKok <aland@freeradius.org>
Fri, 26 Aug 2022 13:56:12 +0000 (09:56 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 28 Aug 2022 14:56:11 +0000 (10:56 -0400)
33 files changed:
src/tests/keywords/cast-ipaddr
src/tests/keywords/cmp-ipaddr
src/tests/keywords/count-error
src/tests/keywords/edit
src/tests/keywords/edit-intersection
src/tests/keywords/edit-list
src/tests/keywords/edit-list-remove
src/tests/keywords/edit-list-reset
src/tests/keywords/edit-merge
src/tests/keywords/edit-merge-lhs
src/tests/keywords/edit-nested
src/tests/keywords/edit-union
src/tests/keywords/escape
src/tests/keywords/escape-sequences
src/tests/keywords/foreach-break
src/tests/keywords/foreach-break-2
src/tests/keywords/foreach-break-3
src/tests/keywords/foreach-break-4 [deleted file]
src/tests/keywords/foreach-error
src/tests/keywords/foreach-isolation
src/tests/keywords/foreach-list
src/tests/keywords/foreach-nested
src/tests/keywords/foreach-regex
src/tests/keywords/foreach-return
src/tests/keywords/foreach-varied-depth
src/tests/keywords/if-multivalue
src/tests/keywords/if-regex-match-named
src/tests/keywords/ipaddr
src/tests/keywords/join
src/tests/keywords/length
src/tests/keywords/pairs
src/tests/keywords/pap-ssha2
src/tests/keywords/truncation

index 4479480b57e19dc9fd31b18001ad0d8dccc78c2c..56f27f2291d53ab529167e80e81768b78e972f28 100644 (file)
@@ -1,38 +1,35 @@
 #
-#  PRE: update if redundant
+#  PRE: if redundant
 #
 &request.NAS-IP-Address                := 127.0.0.1
 &request.Tmp-Integer-0         := 0x7f000001
 
 &Tmp-String-0                  := &NAS-IP-Address
 
-if (<ipaddr>&Tmp-Integer-0[0] != &NAS-IP-Address) {
+if ((ipaddr)&Tmp-Integer-0[0] != &NAS-IP-Address) {
        test_fail
 }
 
 #
-#  Update statements do implicit casts, so we can check
-#  cast results are correct, by using the update to perform
-#  the cast, and looking at the results.
-#
-update request {
-       &Tmp-Cast-Ipaddr        := 203.0.113.1
-       &Tmp-Cast-IPv4Prefix    := 203.0.113.0/24
-       &Tmp-Cast-IPv4Prefix    += 203.0.113.1/32
-       &Tmp-Cast-IPv6Addr      := 2001:DB8::1
-       &Tmp-Cast-IPv6Addr      += ::ffff:203.0.113.1
-       &Tmp-Cast-IPv6Prefix    := 2001:DB8::/32
-       &Tmp-Cast-IPv6Prefix    += ::ffff:203.0.113.1/128
-       &Tmp-Cast-IPv6Prefix    += ::ffff:203.0.113.1/64
+#  Assignments do implicit casts, so we can check cast results are
+#  correct, by using the assignment to perform the cast, and looking
+#  at the results.
+#
+&request += {
+       &Tmp-Cast-Ipaddr        = 203.0.113.1
+       &Tmp-Cast-IPv4Prefix    = 203.0.113.0/24
+       &Tmp-Cast-IPv4Prefix    = 203.0.113.1/32
+       &Tmp-Cast-IPv6Addr      = 2001:DB8::1
+       &Tmp-Cast-IPv6Addr      = ::ffff:203.0.113.1
+       &Tmp-Cast-IPv6Prefix    = 2001:DB8::/32
+       &Tmp-Cast-IPv6Prefix    = ::ffff:203.0.113.1/128
+       &Tmp-Cast-IPv6Prefix    = ::ffff:203.0.113.1/64
 }
 
 #
 #  IPv4 address to IPv6 address
 #
-update control {
-       &Tmp-Cast-IPv6addr      := &Tmp-Cast-IPaddr[0]
-}
-
+&control.Tmp-Cast-IPv6addr     := &Tmp-Cast-IPaddr[0]
 if (&control.Tmp-Cast-IPv6addr[0] != ::ffff:203.0.113.1) {
        test_fail
 }
@@ -40,10 +37,7 @@ if (&control.Tmp-Cast-IPv6addr[0] != ::ffff:203.0.113.1) {
 #
 #  IPv6 address to IPv4 address
 #
-update control {
-       &Tmp-Cast-IPaddr[0]     := &control.Tmp-Cast-IPv6addr[0]
-}
-
+&Tmp-Cast-IPaddr := &control.Tmp-Cast-IPv6addr
 if (&control.Tmp-Cast-IPaddr[0] != 203.0.113.1) {
        test_fail
 }
@@ -51,10 +45,7 @@ if (&control.Tmp-Cast-IPaddr[0] != 203.0.113.1) {
 #
 #  IPv4 prefix to IPv6 prefix
 #
-update control {
-       &Tmp-Cast-IPv6Prefix[0] := &Tmp-Cast-IPv4Prefix[0]
-}
-
+&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-IPv4Prefix[0]
 if (&control.Tmp-Cast-IPv6Prefix[0] != ::ffff:203.0.113.0/120) {
        test_fail
 }
@@ -62,10 +53,7 @@ if (&control.Tmp-Cast-IPv6Prefix[0] != ::ffff:203.0.113.0/120) {
 #
 #  IPv6 prefix to IPv4 prefix
 #
-update control {
-       &Tmp-Cast-IPv4Prefix[0] := &control.Tmp-Cast-IPv6Prefix[0]
-}
-
+&control.Tmp-Cast-IPv4Prefix := &control.Tmp-Cast-IPv6Prefix[0]
 if (&control.Tmp-Cast-IPv4Prefix[0] != 203.0.113.1/24) {
        test_fail
 }
@@ -73,10 +61,7 @@ if (&control.Tmp-Cast-IPv4Prefix[0] != 203.0.113.1/24) {
 #
 #  IPv4 prefix (32) to IPv6 address
 #
-update control {
-       &Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[1]
-}
-
+&control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[1]
 if (&control.Tmp-Cast-IPv6Addr[0] != ::ffff:203.0.113.1) {
        test_fail
 }
@@ -84,10 +69,7 @@ if (&control.Tmp-Cast-IPv6Addr[0] != ::ffff:203.0.113.1) {
 #
 #  IPv6 prefix (128) to IPv4 address
 #
-update control {
-       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[1]
-}
-
+&control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[1]
 if (&control.Tmp-Cast-Ipaddr[0] != 203.0.113.1/32) {
        test_fail
 }
@@ -95,10 +77,7 @@ if (&control.Tmp-Cast-Ipaddr[0] != 203.0.113.1/32) {
 #
 #  IPv4 address to IPv6 prefix (128)
 #
-update control {
-       &Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipaddr[0]
-}
-
+&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipaddr[0]
 if (&control.Tmp-Cast-IPv6Prefix != ::ffff:203.0.113.1/128) {
        test_fail
 }
@@ -106,10 +85,7 @@ if (&control.Tmp-Cast-IPv6Prefix != ::ffff:203.0.113.1/128) {
 #
 #  IPv6 address to IPv4 prefix (32)
 #
-update control {
-       &Tmp-Cast-IPv4Prefix[0] := &Tmp-Cast-IPv6Addr[1]
-}
-
+&control.Tmp-Cast-IPv4Prefix[0] := &Tmp-Cast-IPv6Addr[1]
 if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
        test_fail
 }
@@ -117,10 +93,7 @@ if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
 #
 #  IPv4 address to IPv4 prefix (32)
 #
-update control {
-       &Tmp-Cast-IPv4Prefix := &Tmp-Cast-Ipaddr[0]
-}
-
+&control.Tmp-Cast-IPv4Prefix := &Tmp-Cast-Ipaddr[0]
 if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
        test_fail
 }
@@ -128,10 +101,7 @@ if (&control.Tmp-Cast-IPv4Prefix != 203.0.113.1/32) {
 #
 #  IPv6 address to IPv6 prefix (128)
 #
-update control {
-       &Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipv6addr[0]
-}
-
+&control.Tmp-Cast-IPv6Prefix := &Tmp-Cast-Ipv6addr[0]
 if (&control.Tmp-Cast-IPv6Prefix != 2001:DB8::1/128) {
        test_fail
 }
@@ -139,10 +109,7 @@ if (&control.Tmp-Cast-IPv6Prefix != 2001:DB8::1/128) {
 #
 #  IPv4 prefix (32) to IPv4 address
 #
-update control {
-       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[1]
-}
-
+&control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[1]
 if (&control.Tmp-Cast-Ipaddr != 203.0.113.1) {
        test_fail
 }
@@ -150,10 +117,7 @@ if (&control.Tmp-Cast-Ipaddr != 203.0.113.1) {
 #
 #  IPv6 prefix (128) to IPv6 address
 #
-update control {
-       &Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[1]
-}
-
+&control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[1]
 if (&control.Tmp-Cast-IPv6Addr != ::ffff:203.0.113.1) {
        test_fail
 }
@@ -167,18 +131,14 @@ if (&control.Tmp-Cast-IPv6Addr != ::ffff:203.0.113.1) {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[0]
-               }
-               test_fail
+               &control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv6Prefix[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipv6addr" failed: Invalid cast from ipv6prefix to ipv6addr.  Only /128 (not /32) prefixes may be cast to IP address types') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipv6addr" failed: Invalid cast from ipv6prefix to ipv6addr.  Only /128 (not /32) prefixes may be cast to IP address types') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -188,18 +148,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[2]
-               }
-               test_fail
+               &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[2]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6prefix to ipaddr.  Only /128 (not /64) prefixes may be cast to IP address types') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6prefix to ipaddr.  Only /128 (not /64) prefixes may be cast to IP address types') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -209,18 +165,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-Ipv4Prefix := &Tmp-Cast-IPv6Prefix[2]
-               }
-               test_fail
+               &control.Tmp-Cast-Ipv4Prefix := &Tmp-Cast-IPv6Prefix[2]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6prefix to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6prefix to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -230,18 +182,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[0]
-               }
-               test_fail
+               &control.Tmp-Cast-IPv6Addr := &Tmp-Cast-IPv4Prefix[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipv6addr" failed: Invalid cast from ipv4prefix to ipv6addr.  Only /32 (not /24) prefixes may be cast to IP address types') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipv6addr" failed: Invalid cast from ipv4prefix to ipv6addr.  Only /32 (not /24) prefixes may be cast to IP address types') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -251,18 +199,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[0]
-               }
-               test_fail
+               &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv4Prefix[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv4prefix to ipaddr.  Only /32 (not 24/) prefixes may be cast to IP address types') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv4prefix to ipaddr.  Only /32 (not 24/) prefixes may be cast to IP address types') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -272,18 +216,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[0]
-               }
-               test_fail
+               &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Prefix[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6prefix to ipaddr.  Only /128 (not /32) prefixes may be cast to IP address types') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6prefix to ipaddr.  Only /128 (not /32) prefixes may be cast to IP address types') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -293,18 +233,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-IPv4Prefix := &Tmp-Cast-IPv6Prefix[0]
-               }
-               test_fail
+               &control.Tmp-Cast-IPv4Prefix := &Tmp-Cast-IPv6Prefix[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6prefix to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6prefix to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -314,18 +250,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Addr[0]
-               }
-               test_fail
+               &control.Tmp-Cast-Ipaddr := &Tmp-Cast-IPv6Addr[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6addr to ipaddr.  No IPv4-IPv6 mapping prefix') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipaddr" failed: Invalid cast from ipv6addr to ipaddr.  No IPv4-IPv6 mapping prefix') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
@@ -335,18 +267,14 @@ redundant {
 #
 redundant {
        group {
-               update control {
-                       &Tmp-Cast-IPv4Prefix := &Tmp-Cast-IPv6Addr[0]
-               }
-               test_fail
+               &control.Tmp-Cast-IPv4Prefix := &Tmp-Cast-IPv6Addr[0]
+               fail
        }
        group {
-               if ("%{Module-Failure-Message}" != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6addr to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
+               if (&Module-Failure-Message != 'Assigning value to "Tmp-Cast-ipv4prefix" failed: Invalid cast from ipv6addr to ipv4prefix.  No IPv4-IPv6 mapping prefix') {
                        test_fail
                }
-               update request {
-                       &Module-Failure-Message !* ANY
-               }
+               &request -= &Module-Failure-Message[*]
                ok
        }
 }
index 456dd7b839625eb897f384d8bfa0cdd81c157896..be7884d80a431bfa7a66dad8bae7926af1bb632d 100644 (file)
@@ -1,10 +1,8 @@
 #
-#  PRE: update
+#  PRE: if
 #
-update request {
-       &NAS-IP-Address    := 127.0.0.1
-       &Framed-IP-Address := 127.0.0.1
-}
+&NAS-IP-Address    := 127.0.0.1
+&Framed-IP-Address := 127.0.0.1
 
 #
 #  Check attribute references
@@ -13,10 +11,8 @@ if (!(&NAS-IP-Address == &Framed-IP-Address)) {
        test_fail
 }
 
-update request {
-       &NAS-IP-Address    := 0.0.0.0
-       &Framed-IP-Address := 255.255.255.255
-}
+&NAS-IP-Address    := 0.0.0.0
+&Framed-IP-Address := 255.255.255.255
 
 if (!(&NAS-IP-Address != &Framed-IP-Address)) {
        test_fail
index 8dd52e0bf288999c9a3182b61a129306539fc1b4..c494b20dd4755c1eb02cb0a2d6ac735c7f99e993 100644 (file)
@@ -1,3 +1 @@
-update request {
-       &Tmp-String-0 := &reply.Filter-Id[#]    # ERROR
-}
+&Tmp-String-0 := &reply.Filter-Id[#]   # ERROR
index a2be2d11929b93b87082e6612d257229483ed9af..cfebd211f62979129d35a2043ec9a4b74b334c50 100644 (file)
@@ -1,10 +1,8 @@
 #
-#  PRE: if update
+#  PRE: if
 #
-update request {
-       &Tmp-Integer-0 := 4
-       &Tmp-Integer-1 := 6
-}
+&Tmp-Integer-0 := 4
+&Tmp-Integer-1 := 6
 
 #
 #  Many, many, years of work led up to this!
index 1edf787297e0e53a8a6230756b98ded6f9d9bd69..9efc6c55ba712e799aa0d982c01d90f44a96e8c8 100644 (file)
@@ -2,13 +2,8 @@
 # PRE: edit-list
 #
 
-update control {
-       &Tmp-String-0 := "foo"
-}
-
-update reply {
-       &Tmp-String-0 := "foo"
-}
+&control.Tmp-String-0 := "foo"
+&reply.Tmp-String-0 := "foo"
 
 &reply &= &control
 
@@ -30,9 +25,7 @@ if (&reply.Tmp-String-0 != "foo") {
 #
 # Same attribute, but different value
 #
-update reply {
-       &Tmp-String-0 := "bar"
-}
+&reply.Tmp-String-0 := "bar"
 
 &reply &= &control
 
index e0c6d1c832f652bf2233b9178e399d015a9e889c..b12bf9a9f9144a3291f5d56bbfb418e147a95c7b 100644 (file)
@@ -2,9 +2,7 @@
 # PRE: edit
 #
 
-update control {
-       &Tmp-String-0 := "foo"
-}
+&control.Tmp-String-0 := "foo"
 
 #  Doesn't exist
 if (&request.Tmp-String-0) {
@@ -19,9 +17,7 @@ if (!&request.Tmp-String-0[n]) {
        test_fail
 }
 
-update request {
-       &Tmp-String-0 !* ANY
-}
+&request -= &Tmp-String-0[*]
 
 #  Doesn't exist
 if (&request.Tmp-String-0) {
index d7b57b0e2d88a7914bf8c7a7892633fb8878c626..11ccda4760b68037f8cf3cb51d5753d059ddc6de 100644 (file)
@@ -2,10 +2,10 @@
 # PRE: edit-list
 #
 
-update request {
-       &Tmp-Octets-0 := 0x00
-       &Tmp-String-0 := "foo"
-       &Tmp-Integer-0 := 1
+&request += {
+       &Tmp-Octets-0 = 0x00
+       &Tmp-String-0 = "foo"
+       &Tmp-Integer-0 = 1
 }
 
 #  Does exist
@@ -33,10 +33,10 @@ if (!&request.Tmp-Integer-0) {
 #
 #  Add multiple of the same type
 #
-update request {
-       &Tmp-String-0 := "foo"
-       &Tmp-String-0 += "bar"
-       &Tmp-String-0 += "baz"
+&request += {
+       &Tmp-String-0 = "foo"
+       &Tmp-String-0 = "bar"
+       &Tmp-String-0 = "baz"
 }
 
 if (!&request.Tmp-String-0) {
index ab78d70e05be9b868613215b3524977b8c12e64e..1ec36012fff7ae530cd658c746997b843bee92cf 100644 (file)
@@ -2,9 +2,7 @@
 # PRE: edit-list
 #
 
-update control {
-       &Tmp-String-0 := "foo"
-}
+&control.Tmp-String-0 := "foo"
 
 #  must exist
 if (!&control.Tmp-String-0) {
index 6623be861e0b78cfef5b025fe43b8ebd0e2497b9..44a175f3f9e20f9b2aa51b00714b8c981bd216fb 100644 (file)
@@ -8,13 +8,8 @@
 #      = A' MERGE B' if A and B are lists
 #
 
-update request {
-       &Tmp-String-0 := "foo"
-}
-
-update control {
-       &Tmp-String-0 := "bar"
-}
+&request.Tmp-String-0 := "foo"
+&control.Tmp-String-0 := "bar"
 
 # merge
 &request >= &control
index 800e0629a68ac33f48ab50376894de0351cdd951..c3fc3fd74939b30b29dd412cd6766c6812111042 100644 (file)
@@ -8,13 +8,8 @@
 #      = A' MERGE B' if A and B are lists
 #
 
-update request {
-       &Tmp-String-0 := "foo"
-}
-
-update control {
-       &Tmp-String-0 := "bar"
-}
+&request.Tmp-String-0 := "foo"
+&control.Tmp-String-0 := "bar"
 
 # merge
 &request <= &control
index 13b027125be2010d96e299444f84df86b61debaf..ce70c4a9bc4097e9e052779ce4a31e7d851bc90c 100644 (file)
@@ -1,9 +1,7 @@
 #
 #  PRE: if edit-list
 #
-update control {
-       &User-Name := "foo"
-}
+&control.User-Name := "foo"
 
 #
 #  Create a nested group.
index c4d907e2641b12b3b26514f28d0787b2a178ac02..981d715d004e5c830ce460dc41cb81a349e1fe19 100644 (file)
@@ -8,17 +8,11 @@
 #      = A' UNION B' if A and B are lists
 #
 
-update request {
-       &Tmp-String-0 := "foo"
-}
-
-update control {
-       &Tmp-String-0 := "bar"
-}
+&request.Tmp-String-0 := "foo"
+&control.Tmp-String-0 := "bar"
 
 # union
 &request |= &control
-       %(debug_attr:request[*])
 
 if (!&request.Tmp-String-0) {
        test_fail
index 04afee6cbca4614b870215f3db48aa26b413b5a1..a18246e7e6ca7786a6daa6ef9c76b9dcd91380fc 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  PRE: update if xlat-attr-index
+#  PRE: if xlat-attr-index
 #
 &Tmp-String-0 := '@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /'
 &Tmp-String-1 := '±§#$%^&+={[}];<,>?`|"'
index 3436d9e7cefe5da97c6697f6dfda8f02f8bd7488..d28fbc0674728cd6e6e74d5fae72ad315a8f4c3f 100644 (file)
@@ -1,21 +1,21 @@
 #
-#  PRE: update if xlat-attr-index
+#  PRE: if xlat-attr-index
 #
-update request {
-       &Tmp-Octets-0 := 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65
-       &Tmp-Octets-1 := 0x30783031013078303707307830410A307830440D222230786230b0C2b0
-       &Tmp-String-0 := "i have scary embedded things\000 inside me"
-       &Tmp-String-0 += "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°"
+&request += {
+       &Tmp-Octets-0 = 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65
+       &Tmp-Octets-1 = 0x30783031013078303707307830410A307830440D222230786230b0C2b0
+       &Tmp-String-0 = "i have scary embedded things\000 inside me"
+       &Tmp-String-0 = "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°"
 
        # and again with single quoted strings.
        # unlike other languages, \r, \t, and \n have meaning inside of 'string'
-       &Tmp-String-1 := 'i have scary embedded things\000 inside me'
-       &Tmp-String-1 += '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°'
+       &Tmp-String-1 = 'i have scary embedded things\000 inside me'
+       &Tmp-String-1 = '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°'
 
-       &Tmp-String-2 := 'i have scary embedded things\000 inside me'
-       &Tmp-String-2 += "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°"
+       &Tmp-String-2 = 'i have scary embedded things\000 inside me'
+       &Tmp-String-2 = "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°"
 
-       &Tmp-IP-Address-0 := 127.0.0.1
+       &Tmp-IP-Address-0 = 127.0.0.1
 }
 
 
@@ -27,10 +27,7 @@ if ("%(length:%{Tmp-String-1})" != 42) {
        test_fail
 }
 
-update request {
-       &Tmp-String-8 := "%{string:%{Tmp-Octets-0}}"
-}
-
+&Tmp-String-8 := "%{string:%{Tmp-Octets-0}}"
 if (&Tmp-String-8 != "i have scary embedded things\000 inside me") {
        test_fail
 }
@@ -39,10 +36,7 @@ if (&Tmp-String-0 != "i have scary embedded things\000 inside me") {
        test_fail
 }
 
-update request {
-       &Tmp-String-8 := "%{string:%{Tmp-Octets-1}}"
-}
-
+&Tmp-String-8 := "%{string:%{Tmp-Octets-1}}"
 if (&Tmp-String-8 != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") {
        test_fail
 }
@@ -82,10 +76,7 @@ if (&Tmp-String-2[1] != "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°") {
 #
 #  Other data types
 #
-update request {
-       &Tmp-String-0 := "%{string:&Tmp-IP-Address-0}"
-}
-
+&Tmp-String-0 := "%{string:&Tmp-IP-Address-0}"
 if ("%(length:%{Tmp-String-0})" != 17) {
        test_fail
 }
index 71b3104eef1a686c32f25785d8ec3d4bb89473e8..784da75179ba507547370d4f82bc9342924e97fa 100644 (file)
@@ -4,8 +4,8 @@
 #
 #  We DON'T want to see this one.
 #
-update request {
-       &Filter-Id += "broken"
+&request += {
+       &Filter-Id = "broken"
 }
 
 foreach &Filter-Id {
@@ -17,8 +17,8 @@ foreach &Filter-Id {
                break
        }
 
-       update reply {
-               &Called-Station-Id += "%{Foreach-Variable-0}"
+       &reply += {
+               &Called-Station-Id = "%{Foreach-Variable-0}"
        }
 }
 
@@ -26,36 +26,35 @@ foreach &Filter-Id {
 #
 # Adding attribute during request and immediately breaking
 #
-update {
-       &request.Filter-Id += "1"
-       &request.Filter-Id += "2"
+&request += {
+       &Filter-Id = "1"
+       &Filter-Id = "2"
 }
 
 foreach &request.Reply-Message {
-       if("%{Foreach-Variable-0}" == "1") {
-               update {
-                       &request.Filter-Id += "3"
+       if ("%{Foreach-Variable-0}" == "1") {
+               &request += {
+                       &Filter-Id = "3"
                }
                break
        }
 }
 
-update {
-       &request.Filter-Id !* ANY
-}
+&request -= &Filter-Id[*]
+
 
 #
 # Adding attribute during request and continuing
 #
-update {
-       &request.Filter-Id += "1"
-       &request.Filter-Id += "2"
+&request += {
+       &Filter-Id = "1"
+       &Filter-Id = "2"
 }
 
 foreach &request.Reply-Message {
-       if("%{Foreach-Variable-0}" == "1") {
-               update {
-                       &request.Filter-Id += "3"
+       if ("%{Foreach-Variable-0}" == "1") {
+               &request += {
+                       &Filter-Id = "3"
                }
        }
 
index 74efdd4706f20e0d67168840f74407fabd01b19e..c545439047d851e4e87b5ad4777b0f5ad77872f2 100644 (file)
@@ -2,35 +2,16 @@
 #  PRE: foreach foreach-break
 #
 
-update request {
-       &Tmp-String-0 := "ABCDEF_8"
-}
+&Tmp-String-0 := "ABCDEF_8"
 
-update control {
-       &Tmp-String-0 := "0"
-       &Tmp-String-0 += "1"
-       &Tmp-String-0 += "2"
-       &Tmp-String-0 += "3"
-       &Tmp-String-0 += "4"
-       &Tmp-String-0 += "5"
-       &Tmp-String-0 += "6"
-       &Tmp-String-0 += "7"
-       &Tmp-String-0 += "8"
-       &Tmp-String-0 += "9"
-       &Tmp-String-0 += "a"
-       &Tmp-String-0 += "b"
-       &Tmp-String-0 += "c"
-       &Tmp-String-0 += "d"
-       &Tmp-String-0 += "e"
-       &Tmp-String-0 += "f"
-       &Tmp-String-0 += "g"
-}
+#
+#  This creates a bunch of Tmp-String-0 attributes.
+#
+&control.Tmp-String-0 := { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g" }
 
 foreach &control.Tmp-String-0 {
        if ("%{Tmp-String-0[*]}" =~ /([A-Z0-9\-]*)_%{Foreach-Variable-0}/) {
-               update request {
-                       &Tmp-String-0 := "%{1}"
-               }
+               &Tmp-String-0 := "%{1}"
                success
                break
        }
index 3bc43555a06c0c4f3973b45260b10d7f4d2434b1..b3a7b43c212fc7663ef02abe35664d5d7ed93cb2 100644 (file)
@@ -1,30 +1,9 @@
 #
 #  PRE: foreach foreach-break
 #
+&Calling-Station-Id := "8"
 
-update request {
-       &Calling-Station-Id := "8"
-}
-
-update control {
-       &Calling-Station-Id := "0"
-       &Calling-Station-Id += "1"
-       &Calling-Station-Id += "2"
-       &Calling-Station-Id += "3"
-       &Calling-Station-Id += "4"
-       &Calling-Station-Id += "5"
-       &Calling-Station-Id += "6"
-       &Calling-Station-Id += "7"
-       &Calling-Station-Id += "8"
-       &Calling-Station-Id += "9"
-       &Calling-Station-Id += "a"
-       &Calling-Station-Id += "b"
-       &Calling-Station-Id += "c"
-       &Calling-Station-Id += "d"
-       &Calling-Station-Id += "e"
-       &Calling-Station-Id += "f"
-       &Calling-Station-Id += "g"
-}
+&control.Calling-Station-Id := { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g" }
 
 foreach &control.Calling-Station-Id {
        if (&request.Calling-Station-Id == "%{Foreach-Variable-0}") {
diff --git a/src/tests/keywords/foreach-break-4 b/src/tests/keywords/foreach-break-4
deleted file mode 100644 (file)
index 7ce6149..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#  PRE: foreach foreach-break-3
-#
-
-update request {
-       &Calling-Station-Id := "8"
-}
-
-update control {
-       &Calling-Station-Id := "0"
-       &Calling-Station-Id += "1"
-       &Calling-Station-Id += "2"
-       &Calling-Station-Id += "3"
-       &Calling-Station-Id += "4"
-       &Calling-Station-Id += "5"
-       &Calling-Station-Id += "6"
-       &Calling-Station-Id += "7"
-       &Calling-Station-Id += "8"
-       &Calling-Station-Id += "9"
-       &Calling-Station-Id += "a"
-       &Calling-Station-Id += "b"
-       &Calling-Station-Id += "c"
-       &Calling-Station-Id += "d"
-       &Calling-Station-Id += "e"
-       &Calling-Station-Id += "f"
-       &Calling-Station-Id += "g"
-}
-
-foreach &control.Calling-Station-Id {
-       if (&request.Calling-Station-Id == "%{Foreach-Variable-0}") {
-               success
-               break
-       }
-       elsif ("%{Foreach-Variable-0}" == '9') {
-               test_fail
-
-               reject
-       }
-}
index fb4a2369e855ae8e6a7c75066381a9fa4f8e4541..8fdc11e567e2a1c8e2fcd7022f8504b0aae7e2aa 100644 (file)
@@ -1,5 +1,3 @@
 foreach "%{expr:1 + 2}" {      # ERROR
-       update reply {
-              Called-Station-Id += "%{Foreach-Variable-0}"
-       }
+       &reply.Called-Station-Id += "%{Foreach-Variable-0}"
 }
index 2d0929731acd67ca0d0dca381a677079defe242e..e39c1ed0c436cd68115eb35dc4c12b151c5440af 100644 (file)
@@ -2,19 +2,14 @@
 #  PRE: foreach
 #
 
-update {
-       &control.Tmp-String-0 := '0'
-       &control.Tmp-String-0 += '1'
-       &control.Tmp-String-0 += '2'
-       &control.Tmp-String-0 += '3'
-}
+&control.Tmp-String-0 := { "0", "1", "2", "3" }
 
 foreach &control.Tmp-String-0 {
-       update control {
-               &Tmp-String-0 -= "%{expr:%{Foreach-Variable-0} + 1}"
+       &control -= {
+               &Tmp-String-0 == "%{expr:%{Foreach-Variable-0} + 1}"
        }
-       update request {
-               &Tmp-String-0 += "%{Foreach-Variable-0}"
+       &request += {
+               &Tmp-String-0 = "%{Foreach-Variable-0}"
        }
 }
 
index 9f344085071d6e11b56db74776f979fb65dd9c39..b70775e4f52fe5af6d5c8fecf3a15bf28c794a26 100644 (file)
@@ -1,9 +1,7 @@
-update {
-        &request.Packet-Type !* ANY
-}
+&request -= &Packet-Type[*]
 
 foreach &request {
-       update reply {
-               &Called-Station-Id += "%{Foreach-Variable-0}"
+       &reply += {
+               &Called-Station-Id = "%{Foreach-Variable-0}"
        }
 }
index 49e6be9ab6e38c3bd46358a76c4d159e28a0e127..c4566d59164d872bb17b393fb0d8c1c18be6b755 100644 (file)
@@ -2,8 +2,8 @@
 #
 foreach &Filter-Id {
        foreach &Calling-Station-Id {
-               update reply {
-                       &Called-Station-Id += "%{Foreach-Variable-0} %{Foreach-Variable-1}"
+               &reply += {
+                       &Called-Station-Id = "%{Foreach-Variable-0} %{Foreach-Variable-1}"
                }
        }
 }
index f280e0e952af505b5b40ed860372a6b77d20e3db..efdda351a032e131248f6e321ade2425a4b30660 100644 (file)
@@ -2,15 +2,13 @@
 
 # This is what most people end up using foreach for,
 # so we should probably test it works.
-update request {
-       &Tmp-String-0 := "cisco"
-}
+&Tmp-String-0 := "cisco"
 
 # Expanded regex
 foreach &Vendor-Specific.Cisco.AVPair {
        if ("%{Foreach-Variable-0}"  =~ /^%{Tmp-String-0}=(.*)$/i) {
-               update reply {
-                       &Called-Station-Id += "%{1}"
+               &reply += {
+                       &Called-Station-Id = "%{1}"
                }
        }
 }
@@ -18,8 +16,8 @@ foreach &Vendor-Specific.Cisco.AVPair {
 # Compiled regex
 foreach &Vendor-Specific.Cisco.AVPair {
        if ("%{Foreach-Variable-0}"  =~ /^stupid=(.*)$/i) {
-               update reply {
-                       &Called-Station-Id += "%{1}"
+               &reply += {
+                       &Called-Station-Id = "%{1}"
                }
        }
 }
index 68ec761b8b64cfdee98cf7a7244cdc9974fb20fa..11b4e035c8152c70a53329808088454e4da8dc34 100644 (file)
@@ -4,13 +4,7 @@
 #
 # Adding attribute during request and immediately returning should still work
 #
-update request {
-       &Filter-Id := "1"
-       &Filter-Id += "2"
-       &Filter-Id += "3"
-       &Filter-Id += "4"
-       &Filter-Id += "5"
-}
+&request.Filter-Id := { "1", "2", "3", "4", "5" }
 
 foreach &Filter-Id {
        if ("%{Foreach-Variable-0}" == "3") {
@@ -21,9 +15,7 @@ foreach &Filter-Id {
                #  will prevent the "pap" module from being run
                #  in the "authorize" section.
                #
-               update control {
-                       &Auth-Type := PAP
-               }
+               &control.Auth-Type := PAP
 
                #
                #  Stop processing "authorize", and go to the next section.
index 77a4f75f615e108fd3bd1c5bde14d1ade675c3a6..25962d8500fb6365cee6d6676717dd83b47ec2ee 100644 (file)
@@ -1,17 +1,15 @@
 #
 #  PRE: foreach
 #
-update {
-       &control.Tmp-String-0 := "ssid=ABCDEF"
-       &control.Tmp-String-0 += "ssid=GHIJKL"
+&control += {
+       &Tmp-String-0 = "ssid=ABCDEF"
+       &Tmp-String-0 = "ssid=GHIJKL"
 }
 
 if (&User-Name) {
        foreach &control.Tmp-String-0 {
                if ("%{Foreach-Variable-0}" =~ /(.*)/) {
-                       update control {
-                               &Tmp-String-1 := "%{1}"
-                       }
+                       &control.Tmp-String-1 := "%{1}"
                }
        }
 }
@@ -20,15 +18,11 @@ if (&control.Tmp-String-1 != 'ssid=GHIJKL') {
        test_fail
 }
 
-update control {
-       &Tmp-String-1 !* ANY
-}
+&control -= &Tmp-String-1[*]
 
 foreach &control.Tmp-String-0 {
        if ("%{Foreach-Variable-0}" =~ /(.*)/) {
-               update control {
-                       &Tmp-String-1 := "%{1}"
-               }
+               &control.Tmp-String-1 := "%{1}"
        }
 }
 
@@ -36,8 +30,6 @@ if (&control.Tmp-String-1 != 'ssid=GHIJKL') {
        test_fail
 }
 
-update control {
-       &Tmp-String-1 !* ANY
-}
+&control -= &Tmp-String-1[*]
 
 success
index 0a1e150378dc6afde77f9bef08f489589686f1b2..5be80c6a015c78e560b0af3171eecc434991ea64 100644 (file)
@@ -1,47 +1,47 @@
 #
-# PRE: update if
+# PRE: if
 #
 
-update request {
-       &Tmp-String-0 := 'foo'
-       &Tmp-String-0 += 'bar'
-       &Tmp-String-0 += 'baz'
+&request += {
+       &Tmp-String-0 = 'foo'
+       &Tmp-String-0 = 'bar'
+       &Tmp-String-0 = 'baz'
 
-       &Tmp-String-1 := 'GROUP ADMINISTRATORS'
-       &Tmp-String-1 += 'GROUP STUDENTS'
-       &Tmp-String-1 += 'GROUP PEONS'
+       &Tmp-String-1 = 'GROUP ADMINISTRATORS'
+       &Tmp-String-1 = 'GROUP STUDENTS'
+       &Tmp-String-1 = 'GROUP PEONS'
 
-       &Tmp-String-2 := 'PEONS'
-       &Tmp-String-2 += 'STUDENTS'
-       &Tmp-String-2 += 'ADMINISTRATORS'
+       &Tmp-String-2 = 'PEONS'
+       &Tmp-String-2 = 'STUDENTS'
+       &Tmp-String-2 = 'ADMINISTRATORS'
 
-       &Tmp-String-3 := 'no'
-       &Tmp-String-3 += 'no'
-       &Tmp-String-3 += 'yes'
+       &Tmp-String-3 = 'no'
+       &Tmp-String-3 = 'no'
+       &Tmp-String-3 = 'yes'
 
-       &Tmp-Integer-0 := 1
-       &Tmp-Integer-0 += 2
-       &Tmp-Integer-0 += 5
+       &Tmp-Integer-0 = 1
+       &Tmp-Integer-0 = 2
+       &Tmp-Integer-0 = 5
 }
 
-update control {
-       &Tmp-String-0 := 'foo'
-       &Tmp-String-0 += 'bar'
-       &Tmp-String-0 += 'baz'
+&control += {
+       &Tmp-String-0 = 'foo'
+       &Tmp-String-0 = 'bar'
+       &Tmp-String-0 = 'baz'
 
-       &Tmp-String-1 := 'boink'
-       &Tmp-String-1 += 'tard'
-       &Tmp-String-1 += 'dink'
-       &Tmp-String-1 += 'slink'
+       &Tmp-String-1 = 'boink'
+       &Tmp-String-1 = 'tard'
+       &Tmp-String-1 = 'dink'
+       &Tmp-String-1 = 'slink'
 
-       &Tmp-Integer-0 := 01
-       &Tmp-Integer-0 += 02
-       &Tmp-Integer-0 += 05
-       &Tmp-Integer-0 += 04
+       &Tmp-Integer-0 = 01
+       &Tmp-Integer-0 = 02
+       &Tmp-Integer-0 = 05
+       &Tmp-Integer-0 = 04
 
-       &Tmp-Integer-1 := 10
-       &Tmp-Integer-1 += 20
-       &Tmp-Integer-1 += 30
+       &Tmp-Integer-1 = 10
+       &Tmp-Integer-1 = 20
+       &Tmp-Integer-1 = 30
 }
 
 #
index 0c1056ead4b7020473cc6c213710296e512e8180..b270633d396afe7a0f414a7a910b4051917a90d3 100644 (file)
@@ -1,10 +1,10 @@
 # PRE: if if-failed-xlat
 #
 if (('${feature.regex-pcre}' == 'yes') || ('${feature.regex-pcre2}' == 'yes')) {
-update request {
-       &Tmp-Integer-0 := '123456789'
-       &Tmp-Integer-1 := 1
-}
+       &request += {
+               &Tmp-Integer-0 = '123456789'
+               &Tmp-Integer-1 = 1
+       }
 
 # Check failure when no previous capture - full capture
 if ("%{regex:}") {
@@ -15,41 +15,33 @@ if (&Module-Failure-Message[*] != "No previous regex capture") {
        test_fail
 }
 
-update request {
-       &Module-Failure-Message !* ANY
-}
+&request -= &Module-Failure-Message[*]
 
 # Check failure when no previous capture - named group
 if ("%{regex:foo}") {
        test_fail
 }
 
-if (&Module-Failure-Message[*] != "No previous named regex capture group") {
+if (&Module-Failure-Message != "No previous named regex capture group") {
        test_fail
 }
 
-update request {
-       &Module-Failure-Message !* ANY
-}
+&request -= &Module-Failure-Message[*]
 
 # Check failure when no previous capture - numbered group
 if ("%{regex:%{Tmp-Integer-1}}") {
        test_fail
 }
 
-if (&Module-Failure-Message[*] != "No previous numbered regex capture group") {
+if (&Module-Failure-Message != "No previous numbered regex capture group") {
        test_fail
 }
 
-update request {
-       &Module-Failure-Message !* ANY
-}
+&request -= &Module-Failure-Message[*]
 
 # uncompiled - ref - named capture groups
 if (&User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])%{Tmp-String-1}/) {
-       update request {
-               &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
-       }
+       &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
        if (&Tmp-String-0 != '7_6_5_4_3_2_1_1_2_3_4_5_6_7') {
                test_fail
        }
@@ -60,9 +52,7 @@ else {
 
 # Checking capture groups are cleared out correctly
 if (&User-Name =~ /^(?<one>[0-9])_%{Tmp-String-1}/) {
-       update request {
-               &Tmp-String-0 := "%{0}%{regex:one}%{regex:two}%{regex:three}%{regex:four}%{regex:five}%{regex:six}%{regex:seven}"
-       }
+       &Tmp-String-0 := "%{0}%{regex:one}%{regex:two}%{regex:three}%{regex:four}%{regex:five}%{regex:six}%{regex:seven}"
        if (&Tmp-String-0 != '1_1') {
                test_fail
        }
@@ -73,9 +63,7 @@ else {
 
 # Checking capture groups are cleared out correctly when there are no matches
 if (&User-Name =~ /^.%{Tmp-String-1}/) {
-       update request {
-               &Tmp-String-0 := "%{0}%{regex:one}%{regex:two}%{regex:three}%{regex:four}%{regex:five}%{regex:six}%{regex:seven}"
-       }
+       &Tmp-String-0 := "%{0}%{regex:one}%{regex:two}%{regex:three}%{regex:four}%{regex:five}%{regex:six}%{regex:seven}"
        if (&Tmp-String-0 != '1') {
                test_fail
        }
@@ -86,9 +74,7 @@ else {
 
 # compiled - ref - named capture groups
 if (&User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       update request {
-               &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
-       }
+       &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
        if (&Tmp-String-0 != '7_6_5_4_3_2_1_1_2_3_4_5_6_7') {
                test_fail
        }
@@ -99,9 +85,7 @@ else {
 
 # compiled - xlat - named capture groups
 if ('1_2_3_4_5_6_7' =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       update request {
-               &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
-       }
+       &Tmp-String-0 := "%{regex:seven}_%{regex:six}_%{regex:five}_%{regex:four}_%{regex:three}_%{regex:two}_%{regex:one}_%{0}"
        if (&Tmp-String-0 != '7_6_5_4_3_2_1_1_2_3_4_5_6_7') {
                test_fail
        }
@@ -112,9 +96,7 @@ else {
 
 # compiled - ref - named capture groups (numeric indexes)
 if (&User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       update request {
-               &Tmp-String-0 := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}"
-       }
+       &Tmp-String-0 := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}"
        if (&Tmp-String-0 != '7_6_5_4_3_2_1_1_2_3_4_5_6_7') {
                test_fail
        }
@@ -126,19 +108,16 @@ else {
 
 # compiled - ref - named capture groups (numeric indexes using expansion)
 if (&User-Name =~ /^(?<one>[0-9])_(?<two>[0-9])?_(?<three>[0-9]*)_(?<four>[0-9]+)_(?<five>[^_])_(?<six>6)_(?<seven>[7-8])/) {
-       update request {
-               &Tmp-Integer-0 := 0
-               &Tmp-Integer-1 := 1
-               &Tmp-Integer-2 := 2
-               &Tmp-Integer-3 := 3
-               &Tmp-Integer-4 := 4
-               &Tmp-Integer-5 := 5
-               &Tmp-Integer-6 := 6
-               &Tmp-Integer-7 := 7
-       }
-       update request {
-               &Tmp-String-0 := "%{regex:%{Tmp-Integer-7}}_%{regex:%{Tmp-Integer-6}}_%{regex:%{Tmp-Integer-5}}_%{regex:%{Tmp-Integer-4}}_%{regex:%{Tmp-Integer-3}}_%{regex:%{Tmp-Integer-2}}_%{regex:%{Tmp-Integer-1}}_%{regex:%{Tmp-Integer-0}}"
-       }
+       &Tmp-Integer-0 := 0
+       &Tmp-Integer-1 := 1
+       &Tmp-Integer-2 := 2
+       &Tmp-Integer-3 := 3
+       &Tmp-Integer-4 := 4
+       &Tmp-Integer-5 := 5
+       &Tmp-Integer-6 := 6
+       &Tmp-Integer-7 := 7
+
+       &Tmp-String-0 := "%{regex:%{Tmp-Integer-7}}_%{regex:%{Tmp-Integer-6}}_%{regex:%{Tmp-Integer-5}}_%{regex:%{Tmp-Integer-4}}_%{regex:%{Tmp-Integer-3}}_%{regex:%{Tmp-Integer-2}}_%{regex:%{Tmp-Integer-1}}_%{regex:%{Tmp-Integer-0}}"
        if (&Tmp-String-0 != '7_6_5_4_3_2_1_1_2_3_4_5_6_7') {
                test_fail
        }
index 6a0d62bf8a54dffe9d245944fdf8052e07ffc4e8..697676d979544de79e4a865824904a7cba3d7209 100644 (file)
@@ -1,5 +1,5 @@
 #
-#  PRE: update if
+#  PRE: if
 #
 
 &request += {
index 7bc1feff51d46130500547eb90294962fe9d35c9..843963190113eb22ca4f433c4824169d97871cda 100644 (file)
@@ -1,26 +1,28 @@
 #
 # PRE: update if concat
 #
-update {
-        &request.Packet-Type !* ANY
-}
+&request -= &Packet-Type[*]
 
-update {
-        &request.Tmp-String-0 := "ab c"
-        &request.Tmp-String-0 += "de fg"
-        &request.Tmp-Integer-0 := 123
-        &control.Tmp-IP-Address-0 := 192.168.1.254
+&request += {
+        &Tmp-String-0 = "ab c"
+        &Tmp-String-0 = "de fg"
+        &Tmp-Integer-0 = 123
 }
 
-update {
-        &request.Tmp-String-1 := "%(concat:%(join:%{request[*]} %{control.Tmp-IP-Address-0}) '. ')"
-        &request.Tmp-String-2 := "%(concat:%(join:%{Tmp-String-0[*]} %{Tmp-Integer-0}) ,)"
-}
+&control.Tmp-IP-Address-0 := 192.168.1.254
+
+#
+#  The new code produces a group of groups?
+#
+#update request {
+        &Tmp-String-1 := "%(concat:%(join:%{request[*]} %{control.Tmp-IP-Address-0}) '. ')"
+#}
 
 if (&request.Tmp-String-1 != "bob. hello. ab c. de fg. 123. 192.168.1.254") {
         test_fail
 }
 
+&Tmp-String-2 := "%(concat:%(join:%{Tmp-String-0[*]} %{Tmp-Integer-0}) ,)"
 if (&request.Tmp-String-2 != "ab c,de fg,123") {
         test_fail
 }
index 9df97ae36b24927f949e3c987055c59e0c6104e1..30314f0f16a18a8b21c8f01a96dc4aac97a60be1 100644 (file)
@@ -1,47 +1,43 @@
 #
 # PRE: hex
 #
-update request {
-       &Tmp-String-0        := '\
+&request += {
+       &Tmp-String-0        = '\
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
-       &Tmp-String-2        := '9870'
-       &Tmp-Octets-0        := 0x39383731
-       &Tmp-IP-Address-0    := 57.56.55.50
-       &Tmp-Integer-0       := 959985460
-       &Tmp-Cast-IfId       := '0000:0000:3938:3737'
-       &Tmp-Cast-IPv6Addr   := '::3938:3738'
-       &Tmp-Cast-IPv6Prefix := '::3938:3739/128'
-       &Tmp-Cast-Byte       := 58
-       &Tmp-Cast-Short      := 14139
-       &Tmp-Cast-Ether   := 00:00:39:38:37:3c
-       &Tmp-Cast-Integer64  := 1152921505566832445
-       &Tmp-Cast-IPv4Prefix := 57.56.55.62/32
-}
-
-update request {
-       &Tmp-Integer-0        := "%(length:%{Tmp-String-0})"
-}
-
-if (&Tmp-Integer-0 != 260) {
+       &Tmp-String-2        = '9870'
+       &Tmp-Octets-0        = 0x39383731
+       &Tmp-IP-Address-0    = 57.56.55.50
+       &Tmp-Integer-0       = 959985460
+       &Tmp-Cast-IfId       = '0000:0000:3938:3737'
+       &Tmp-Cast-IPv6Addr   = '::3938:3738'
+       &Tmp-Cast-IPv6Prefix = '::3938:3739/128'
+       &Tmp-Cast-Byte       = 58
+       &Tmp-Cast-Short      = 14139
+       &Tmp-Cast-Ether      = 00:00:39:38:37:3c
+       &Tmp-Cast-Integer64  = 1152921505566832445
+       &Tmp-Cast-IPv4Prefix = 57.56.55.62/32
+}
+
+if (%(length:%{Tmp-String-0}) != 260) {
        test_fail
 }
 
-update request {
-       &Tmp-Integer-0        := "%(length:%{Tmp-String-2})"
-       &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})"
+&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})"
 }
 
 # String - bin 0x39383730
-if (&Tmp-Integer-0 != 4) {
+if (&Tmp-uint64-0 != 4) {
        test_fail
 }
 
@@ -85,12 +81,10 @@ if (&Tmp-Integer-9 != 1) {
        test_fail
 }
 
-update request {
-       &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) {
index 9841adb0d196e27109cfe627d8495438022f919a..fb60e13d2bdee90bfa070940582be57183201878 100644 (file)
@@ -1,23 +1,21 @@
 #
 # PRE: update if
 #
-update {
-        &request.Packet-Type !* ANY
-}
+&request -= &Packet-Type[*]
 
-update {
-       &request.Tmp-String-0 := "This is a string"
-       &request.Tmp-String-0 += "This is another one"
-       &request.Tmp-Octets-0 := 0x000504030201
-       &request.Tmp-Integer-0 := 7331
+&request += {
+       &Tmp-String-0 = "This is a string"
+       &Tmp-String-0 = "This is another one"
+       &Tmp-Octets-0 = 0x000504030201
+       &Tmp-Integer-0 = 7331
 }
 
-update {
-       &request.Tmp-String-1 := "%(concat:%(pairs:request[*]) ', ')"
-       &request.Tmp-String-2 := "%(pairs:Tmp-String-0)"
-       &request.Tmp-String-3 := "%(concat:%(pairs:Tmp-String-0[*]) ', ')"
-       &request.Tmp-String-4 := "%(concat:%(pairs:control.) ', ')"
-       &request.Tmp-String-5 := "%(pairs:control.User-Name)"
+&request += {
+       &Tmp-String-1 = "%(concat:%(pairs:request[*]) ', ')"
+       &Tmp-String-2 = "%(pairs:Tmp-String-0)"
+       &Tmp-String-3 = "%(concat:%(pairs:Tmp-String-0[*]) ', ')"
+       &Tmp-String-4 = "%(concat:%(pairs:control.) ', ')"
+       &Tmp-String-5 = "%(pairs:control.User-Name)"
 }
 
 if (&request.Tmp-String-1 != "User-Name = \"bob\", User-Password = \"hello\", Tmp-String-0 = \"This is a string\", Tmp-String-0 = \"This is another one\", Tmp-Octets-0 = 0x000504030201, Tmp-Integer-0 = 7331") {
index 16b3f8f09a0994d68df4836773da72524fbaf953..af24ef9743efeb18b6102ba9598bb8d8c84c8e64 100644 (file)
@@ -6,22 +6,17 @@
 #  Skip if the server wasn't built with openssl
 #
 if ('${feature.tls}' != 'yes') {
-       update reply {
-               &Packet-Type := Access-Accept
-       }
+       &reply.Packet-Type := Access-Accept
        handled
 }
 
-update {
-       &control !* ANY
-       &Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt
-}
+&Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK"        # 60 byte salt
 
 #
 #  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
@@ -32,30 +27,19 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
 #
 #  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}}"
-}
-
-update {
-       &control.Password.With-Header += "{ssha512}%{control.Tmp-String-1}"
-}
+&control.Tmp-String-1 := "%{base64:%{control.Tmp-Octets-0}}"
+&control.Password.With-Header += "{ssha512}%{control.Tmp-String-1}"
 
 pap.authorize
 pap.authenticate {
@@ -65,30 +49,20 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
 #
 #  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
 pap.authenticate {
@@ -98,15 +72,11 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
 #
 #  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
@@ -117,20 +87,14 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
-update control {
-       &Auth-Type := Accept
+&control := {
+       &Auth-Type = Accept
 }
 
 #
 #  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 {
@@ -140,15 +104,11 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
 #
 #  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
@@ -159,13 +119,8 @@ if (reject) {
        test_fail
 }
 
-update {
-       &control !* ANY
-}
-
-
-update control {
-       &Auth-Type := Accept
+&control := {
+       &Auth-Type = Accept
 }
 
 success
index 20afeef66cd030f47423d3b6509dd5b7e026d7df..dd6fc0b96a8e2936541453dba406639ae246ab0b 100644 (file)
@@ -75,11 +75,7 @@ a02f4a3ab98d75992d68a15d393387fe9ef01041569570ad6fe884764e55567311bcacfcffae7655
 }
 
 # Actual length of octet string is 4083 bytes
-update request {
-       &Tmp-Integer-0 := "%(length:%{Tmp-Octets-0})"
-}
-
-if (&Tmp-Integer-0 != 4083) {
+if (%(length:%{Tmp-Octets-0}) != 4083) {
        test_fail
 }
 
@@ -88,9 +84,7 @@ if ("%{Tmp-Octets-0}" !~ /^0x([0-9a-f]+)$/) {
        test_fail
 }
 
-update request {
-       &Tmp-String-0 := "%{1}"
-}
+&Tmp-String-0 := "%{1}"
 
 if ("%(length:%{Tmp-String-0})" != 8166) {
        test_fail