#
-# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
# 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
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
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
}
}
#
-# 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
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
-update request {
- &Tmp-String-0 := &reply.Filter-Id[#] # ERROR
-}
+&Tmp-String-0 := &reply.Filter-Id[#] # ERROR
#
-# 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!
# 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
#
# Same attribute, but different value
#
-update reply {
- &Tmp-String-0 := "bar"
-}
+&reply.Tmp-String-0 := "bar"
&reply &= &control
# PRE: edit
#
-update control {
- &Tmp-String-0 := "foo"
-}
+&control.Tmp-String-0 := "foo"
# Doesn't exist
if (&request.Tmp-String-0) {
test_fail
}
-update request {
- &Tmp-String-0 !* ANY
-}
+&request -= &Tmp-String-0[*]
# Doesn't exist
if (&request.Tmp-String-0) {
# 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
#
# 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) {
# PRE: edit-list
#
-update control {
- &Tmp-String-0 := "foo"
-}
+&control.Tmp-String-0 := "foo"
# must exist
if (!&control.Tmp-String-0) {
# = 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
# = 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
#
# PRE: if edit-list
#
-update control {
- &User-Name := "foo"
-}
+&control.User-Name := "foo"
#
# Create a nested group.
# = 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
#
-# PRE: update if xlat-attr-index
+# PRE: if xlat-attr-index
#
&Tmp-String-0 := '@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /'
&Tmp-String-1 := '±§#$%^&+={[}];<,>?`|"'
#
-# 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
}
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
}
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
}
#
# 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
}
#
# We DON'T want to see this one.
#
-update request {
- &Filter-Id += "broken"
+&request += {
+ &Filter-Id = "broken"
}
foreach &Filter-Id {
break
}
- update reply {
- &Called-Station-Id += "%{Foreach-Variable-0}"
+ &reply += {
+ &Called-Station-Id = "%{Foreach-Variable-0}"
}
}
#
# 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"
}
}
# 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
}
#
# 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}") {
+++ /dev/null
-#
-# 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
- }
-}
foreach "%{expr:1 + 2}" { # ERROR
- update reply {
- Called-Station-Id += "%{Foreach-Variable-0}"
- }
+ &reply.Called-Station-Id += "%{Foreach-Variable-0}"
}
# 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}"
}
}
-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}"
}
}
#
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}"
}
}
}
# 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}"
}
}
}
# Compiled regex
foreach &Vendor-Specific.Cisco.AVPair {
if ("%{Foreach-Variable-0}" =~ /^stupid=(.*)$/i) {
- update reply {
- &Called-Station-Id += "%{1}"
+ &reply += {
+ &Called-Station-Id = "%{1}"
}
}
}
#
# 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") {
# 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.
#
# 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}"
}
}
}
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}"
}
}
test_fail
}
-update control {
- &Tmp-String-1 !* ANY
-}
+&control -= &Tmp-String-1[*]
success
#
-# 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
}
#
# 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:}") {
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
}
# 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
}
# 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
}
# 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
}
# 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
}
# 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
}
# 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
}
#
-# PRE: update if
+# PRE: if
#
&request += {
#
# 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
}
#
# 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
}
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) {
#
# 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") {
# 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
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 {
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 {
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
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 {
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
test_fail
}
-update {
- &control !* ANY
-}
-
-
-update control {
- &Auth-Type := Accept
+&control := {
+ &Auth-Type = Accept
}
success
}
# 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
}
test_fail
}
-update request {
- &Tmp-String-0 := "%{1}"
-}
+&Tmp-String-0 := "%{1}"
if ("%(length:%{Tmp-String-0})" != 8166) {
test_fail