# Tests for dereferencing the Nth attribute
#
&request += {
- &Class = 0x01020304,
- &Class = 0x05060708,
- &Class = 0x090a0b0c,
+ &Class = 0x01020304,
+ &Class = 0x05060708,
+ &Class = 0x090a0b0c,
}
if (%{Class[#]} != 3) {
#
switch &reply.Filter-Id {
case "filter" {
- ok
+ ok
}
case "filter" { # ERROR
#
# PRE: if
#
-&NAS-IP-Address := 127.0.0.1
+&NAS-IP-Address := 127.0.0.1
&Framed-IP-Address := 127.0.0.1
#
test_fail
}
-&NAS-IP-Address := 0.0.0.0
+&NAS-IP-Address := 0.0.0.0
&Framed-IP-Address := 255.255.255.255
if (!(&NAS-IP-Address != &Framed-IP-Address)) {
#Nine comment (tabs and spaces, are you crazy?!)
update { #}'{ Opening block with extra special chars {} '"
- &control.User-Name := 'whatever' # do some random stuff
+ &control.User-Name := 'whatever' # do some random stuff
} #{'} Closing block with extra special chars {} '"
update { &request.Tmp-String-0 := 'candy' } # Comment after unicorn block
&control.Password.Cleartext := "fail"
else { # ERROR
- ok
+ ok
}
}
# attribute doesn't exist.
#
if (&Not-Dynamically-Allocated) { # ERROR
- # foo
+ # foo
}
# Static if condition
#
if (1) {
- # we allow empty 'if' conditions
+ # we allow empty 'if' conditions
}
if (0) {
- # this never gets compiled
+ # this never gets compiled
}
# we can magically have multiline "if" statements.
#
if (1 + 2
- != 3) {
+ != 3) {
test_fail
}
success
&request -= &Packet-Type[*]
&request += {
- &Tmp-String-0 = "ab c"
- &Tmp-String-0 = "de fg"
- &Tmp-Integer-0 = 123
+ &Tmp-String-0 = "ab c"
+ &Tmp-String-0 = "de fg"
+ &Tmp-Integer-0 = 123
}
&control.Tmp-IP-Address-0 := 192.168.1.254
&control.Tmp-String-1 := "%(concat:%(join:%(ungroup:%{request[*]}) %{control.Tmp-IP-Address-0}) '. ')"
if (&control.Tmp-String-1 != "bob. hello. ab c. de fg. 123. 192.168.1.254") {
- test_fail
+ 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
+ test_fail
}
success
# PRE: hex
#
&request += {
- &Tmp-String-0 = '\
+ &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-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-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
}
}
&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})"
+ &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
test_fail
}
-&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) {
# Should distribute load between the modules.
#
&request += {
- &Tmp-Integer-0 = 0
- &Tmp-Integer-1 = 0
+ &Tmp-Integer-0 = 0
+ &Tmp-Integer-1 = 0
- &Tmp-Integer-2 = 0 # 0
- &Tmp-Integer-2 = 1
- &Tmp-Integer-2 = 2
- &Tmp-Integer-2 = 3
- &Tmp-Integer-2 = 4
- &Tmp-Integer-2 = 5
- &Tmp-Integer-2 = 6
- &Tmp-Integer-2 = 7
- &Tmp-Integer-2 = 8
- &Tmp-Integer-2 = 9 # 10
- &Tmp-Integer-2 = 0
- &Tmp-Integer-2 = 1
- &Tmp-Integer-2 = 2
- &Tmp-Integer-2 = 3
- &Tmp-Integer-2 = 4
- &Tmp-Integer-2 = 5
- &Tmp-Integer-2 = 6
- &Tmp-Integer-2 = 7
- &Tmp-Integer-2 = 8
- &Tmp-Integer-2 = 9 # 20
- &Tmp-Integer-2 = 0
- &Tmp-Integer-2 = 1
- &Tmp-Integer-2 = 2
- &Tmp-Integer-2 = 3
- &Tmp-Integer-2 = 4
- &Tmp-Integer-2 = 5
- &Tmp-Integer-2 = 6
- &Tmp-Integer-2 = 7
- &Tmp-Integer-2 = 8
- &Tmp-Integer-2 = 9 # 30
- &Tmp-Integer-2 = 0
- &Tmp-Integer-2 = 1
- &Tmp-Integer-2 = 2
- &Tmp-Integer-2 = 3
- &Tmp-Integer-2 = 4
- &Tmp-Integer-2 = 5
- &Tmp-Integer-2 = 6
- &Tmp-Integer-2 = 7
- &Tmp-Integer-2 = 8
- &Tmp-Integer-2 = 9 # 40
- &Tmp-Integer-2 = 0
- &Tmp-Integer-2 = 1
- &Tmp-Integer-2 = 2
- &Tmp-Integer-2 = 3
- &Tmp-Integer-2 = 4
- &Tmp-Integer-2 = 5
- &Tmp-Integer-2 = 6
- &Tmp-Integer-2 = 7
- &Tmp-Integer-2 = 8
- &Tmp-Integer-2 = 9 # 49
+ &Tmp-Integer-2 = 0 # 0
+ &Tmp-Integer-2 = 1
+ &Tmp-Integer-2 = 2
+ &Tmp-Integer-2 = 3
+ &Tmp-Integer-2 = 4
+ &Tmp-Integer-2 = 5
+ &Tmp-Integer-2 = 6
+ &Tmp-Integer-2 = 7
+ &Tmp-Integer-2 = 8
+ &Tmp-Integer-2 = 9 # 10
+ &Tmp-Integer-2 = 0
+ &Tmp-Integer-2 = 1
+ &Tmp-Integer-2 = 2
+ &Tmp-Integer-2 = 3
+ &Tmp-Integer-2 = 4
+ &Tmp-Integer-2 = 5
+ &Tmp-Integer-2 = 6
+ &Tmp-Integer-2 = 7
+ &Tmp-Integer-2 = 8
+ &Tmp-Integer-2 = 9 # 20
+ &Tmp-Integer-2 = 0
+ &Tmp-Integer-2 = 1
+ &Tmp-Integer-2 = 2
+ &Tmp-Integer-2 = 3
+ &Tmp-Integer-2 = 4
+ &Tmp-Integer-2 = 5
+ &Tmp-Integer-2 = 6
+ &Tmp-Integer-2 = 7
+ &Tmp-Integer-2 = 8
+ &Tmp-Integer-2 = 9 # 30
+ &Tmp-Integer-2 = 0
+ &Tmp-Integer-2 = 1
+ &Tmp-Integer-2 = 2
+ &Tmp-Integer-2 = 3
+ &Tmp-Integer-2 = 4
+ &Tmp-Integer-2 = 5
+ &Tmp-Integer-2 = 6
+ &Tmp-Integer-2 = 7
+ &Tmp-Integer-2 = 8
+ &Tmp-Integer-2 = 9 # 40
+ &Tmp-Integer-2 = 0
+ &Tmp-Integer-2 = 1
+ &Tmp-Integer-2 = 2
+ &Tmp-Integer-2 = 3
+ &Tmp-Integer-2 = 4
+ &Tmp-Integer-2 = 5
+ &Tmp-Integer-2 = 6
+ &Tmp-Integer-2 = 7
+ &Tmp-Integer-2 = 8
+ &Tmp-Integer-2 = 9 # 49
}
#
map foo { # ERROR
- User-Name = 'foo'
+ User-Name = 'foo'
}
# PRE: map-2arg-error map-empty-error map-module-error
#
map csv &User-Name {
- reply.Filter-Id := 'field2' # ERROR
+ reply.Filter-Id := 'field2' # ERROR
}
&request += {
- &Tmp-Octets-1 = "%{md4:This is a string\n}"
- &Tmp-Octets-2 = "%{md4:%{Tmp-String-0}}"
- &Tmp-Octets-3 = "%{md4:%{request.Tmp-String-0}}"
- &Tmp-Octets-4 = "%{md4:%{request.Tmp-Octets-0}}"
- &Tmp-Octets-5 = "%{md4:%{Tmp-String-9}}"
+ &Tmp-Octets-1 = "%{md4:This is a string\n}"
+ &Tmp-Octets-2 = "%{md4:%{Tmp-String-0}}"
+ &Tmp-Octets-3 = "%{md4:%{request.Tmp-String-0}}"
+ &Tmp-Octets-4 = "%{md4:%{request.Tmp-Octets-0}}"
+ &Tmp-Octets-5 = "%{md4:%{Tmp-String-9}}"
}
#
&request += {
- &Tmp-Octets-1 = "%{md5:This is a string\n}"
- &Tmp-Octets-2 = "%{md5:%{Tmp-String-0}}"
- &Tmp-Octets-3 = "%{md5:%{request.Tmp-String-0}}"
- &Tmp-Octets-4 = "%{md5:%{request.Tmp-Octets-0}}"
- &Tmp-Octets-5 = "%{md5:%{Tmp-String-9}}"
- &Tmp-Octets-6 = "%(hmacmd5:%{Tmp-String-1} %{Tmp-String-2})"
- &Tmp-Octets-7 = "%(hmacmd5:%{Tmp-String-3} %{Tmp-String-3})"
+ &Tmp-Octets-1 = "%{md5:This is a string\n}"
+ &Tmp-Octets-2 = "%{md5:%{Tmp-String-0}}"
+ &Tmp-Octets-3 = "%{md5:%{request.Tmp-String-0}}"
+ &Tmp-Octets-4 = "%{md5:%{request.Tmp-Octets-0}}"
+ &Tmp-Octets-5 = "%{md5:%{Tmp-String-9}}"
+ &Tmp-Octets-6 = "%(hmacmd5:%{Tmp-String-1} %{Tmp-String-2})"
+ &Tmp-Octets-7 = "%(hmacmd5:%{Tmp-String-3} %{Tmp-String-3})"
}
#
# MS CHAPv1
update request {
- &User-Name := 'EXAMPLE\bob'
+ &User-Name := 'EXAMPLE\bob'
&Vendor-Specific.Microsoft.CHAP-Challenge := 0xe96e4fff2955c4f1
&Vendor-Specific.Microsoft.CHAP-Response := 0x00010000000000000000000000000000000000000000000000008860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f
}
&request += {
- &Tmp-Octets-0 = "%(mschap:Challenge)"
- &Tmp-Octets-1 = "%(mschap:NT-Response)"
- &Tmp-String-0 = "%(mschap:NT-Domain)"
- &Tmp-String-1 = "%(mschap:User-Name)"
+ &Tmp-Octets-0 = "%(mschap:Challenge)"
+ &Tmp-Octets-1 = "%(mschap:NT-Response)"
+ &Tmp-String-0 = "%(mschap:NT-Domain)"
+ &Tmp-String-1 = "%(mschap:User-Name)"
}
if (&Tmp-Octets-0 != 0xe96e4fff2955c4f1) {
- test_fail
+ test_fail
}
if (&Tmp-Octets-1 != 0x8860bbaac0cd3960b4ce5dc6f0f7a462b897ef530484e80f) {
- test_fail
+ test_fail
}
if (&Tmp-String-0 != 'EXAMPLE') {
- test_fail
+ test_fail
}
if (&Tmp-String-1 != 'bob') {
- test_fail
+ test_fail
}
update request {
}
update request {
- &Tmp-Octets-0 := "%(mschap:LM-Response)"
+ &Tmp-Octets-0 := "%(mschap:LM-Response)"
}
if (&Tmp-Octets-0 != 0x6937d7935bb28a4c1dafe6a193bdea7a853a74d8bcf6db15) {
- test_fail
+ test_fail
}
# Hashing
update request {
- &Tmp-Octets-0 := "%(mschap:NT-Hash testing_123)"
- &Tmp-Octets-1 := "%(mschap:LM-Hash testing_123)"
+ &Tmp-Octets-0 := "%(mschap:NT-Hash testing_123)"
+ &Tmp-Octets-1 := "%(mschap:LM-Hash testing_123)"
}
if (&Tmp-Octets-0 != 0xfa782604f85eb3564f555648341b53e4) {
- test_fail
+ test_fail
}
if (&Tmp-Octets-1 != 0x2d5545077d7b7d2ae4343f96ab15c596) {
- test_fail
+ test_fail
}
# MS CHAPv2
update request {
- &Vendor-Specific.Microsoft.CHAP-Response !* ANY
- &Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e
- &Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200
+ &Vendor-Specific.Microsoft.CHAP-Response !* ANY
+ &Vendor-Specific.Microsoft.CHAP-Challenge := 0x04408dc2a98dae1ce351dfc53f57d08e
+ &Vendor-Specific.Microsoft.CHAP2-Response := 0x00010e93cfbfcef8d5b6af42d2b2ca5b43180000000000000000bc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b200
}
update request {
- &Tmp-Octets-0 := "%(mschap:Challenge)"
- &Tmp-Octets-1 := "%(mschap:NT-Response)"
+ &Tmp-Octets-0 := "%(mschap:Challenge)"
+ &Tmp-Octets-1 := "%(mschap:NT-Response)"
}
if (&Tmp-Octets-0 != 0xad18b6b8e1478b4c) {
- test_fail
+ test_fail
}
if (&Tmp-Octets-1 != 0xbc068d1e8c54de5e9db78e6736d686eb88a999dd7fa239b2) {
- test_fail
+ test_fail
}
# Invalid
update request {
- &Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428
+ &Vendor-Specific.Microsoft.CHAP-Challenge := 0xf0eac4151d5346662ba8c5e428
}
update request {
- &Tmp-String-0 := "%(mschap:Challenge)"
+ &Tmp-String-0 := "%(mschap:Challenge)"
}
if (&Tmp-String-0 != "") {
- test_fail
+ test_fail
}
if (&Module-Failure-Message != "Invalid MS-CHAP challenge length") {
- test_fail
+ test_fail
}
success
\ No newline at end of file
# We have a fudge factor of 1 second either way
if ((&Tmp-Integer-0 < 3599) || (&Tmp-Integer-0 > 3601)) {
- test_fail
+ test_fail
}
#
#
&Tmp-Integer-0 := "%{expr:%(nexttime:3d) - %(nexttime:1d)}"
if ((&Tmp-Integer-0 < 172799) || (&Tmp-Integer-0 > 172801)) {
- test_fail
+ test_fail
}
#
#
&Tmp-Integer-0 := "%{expr:%(nexttime:4w) - %(nexttime:2w)}"
if ((&Tmp-Integer-0 < 1209599) || (&Tmp-Integer-0 > 1209601)) {
- test_fail
+ test_fail
}
success
}
if (&Tmp-Integer-0 != "%{Tmp-Integer-1[#]}") {
- test_fail
+ test_fail
}
success
# Stop processing "authorize", and go to the next section.
#
return { # ERROR
- ok = 1
+ ok = 1
}
#
# PRE: update unknown
#
update control {
- This-Does-Not-Exist = 1 # ERROR
+ This-Does-Not-Exist = 1 # ERROR
}
update control {
- &Password.Cleartext := 'hello'
+ &Password.Cleartext := 'hello'
}
success
#
update request {
- &Class := 0x01020304
- &Class += 0x05060708
- &Class += 0x090a0b0c
+ &Class := 0x01020304
+ &Class += 0x05060708
+ &Class += 0x090a0b0c
}
# All attributes should now of been removed
if ((&Tmp-String-0 && (&Tmp-String-0 == 'foobarbaz')) || \
- (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \
- (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) {
+ (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \
+ (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) {
test_fail
}
# Malformed expansion should be a parse error.
#
update request {
- &Tmp-String-0 = `/bin/sh -c %{User-Name` # ERROR
+ &Tmp-String-0 = `/bin/sh -c %{User-Name` # ERROR
}
# PRE: update
#
update reply {
- &Tmp-String-0 := "foo"
+ &Tmp-String-0 := "foo"
- #
- # This is a string, so it's NOT allowed.
- #
- &Tmp-String-1 := {
+ #
+ # This is a string, so it's NOT allowed.
+ #
+ &Tmp-String-1 := {
Tmp-String-2 := "1.0" # ERROR
- }
+ }
}
# Only the 1st, 2nd, 3rd and 5th Tmp-IP-Address attributes should still be in the list
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.1') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[2]}" != '192.0.2.3') || \
- ("%{Tmp-IP-Address-0[3]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[4]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.2') || \
+ ("%{Tmp-IP-Address-0[2]}" != '192.0.2.3') || \
+ ("%{Tmp-IP-Address-0[3]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[4]}" != '')) {
test_fail
}
# Should be the same as the previous result
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.1') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[2]}" != '192.0.2.3') || \
- ("%{Tmp-IP-Address-0[3]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[4]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.2') || \
+ ("%{Tmp-IP-Address-0[2]}" != '192.0.2.3') || \
+ ("%{Tmp-IP-Address-0[3]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[4]}" != '')) {
test_fail
}
# IP address at index 0 should be removed
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
- ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[3]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
+ ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[3]}" != '')) {
test_fail
}
# Should be the same as the previous result
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
- ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[3]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
+ ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[3]}" != '')) {
test_fail
}
# All attributes should now of been removed
if ((&Tmp-String-0 && (&Tmp-String-0 == 'foobarbaz')) || \
- (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \
- (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) {
+ (&Tmp-Integer-0 && (&Tmp-Integer-0 == 123456789)) || \
+ (&Tmp-IP-Address-0 && (&Tmp-IP-Address-0 == 192.0.2.1))) {
test_fail
}
}
if (("%{Tmp-IP-Address-0[0]}" != 192.0.2.1) || \
- ("%{Tmp-IP-Address-0[1]}" != 192.0.2.2) || \
- ("%{Tmp-IP-Address-0[2]}" != 192.0.2.3) || \
- ("%{Tmp-IP-Address-0[3]}" != 192.0.2.4)) {
+ ("%{Tmp-IP-Address-0[1]}" != 192.0.2.2) || \
+ ("%{Tmp-IP-Address-0[2]}" != 192.0.2.3) || \
+ ("%{Tmp-IP-Address-0[3]}" != 192.0.2.4)) {
test_fail
}
# Only the 2nd, 3rd and 4th Tmp-IP-Address attributes should still be in the list
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
- ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[3]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.3') || \
+ ("%{Tmp-IP-Address-0[2]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[3]}" != '')) {
test_fail
}
# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[2]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[2]}" != '')) {
test_fail
}
# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '192.0.2.4') || \
- ("%{Tmp-IP-Address-0[2]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '192.0.2.4') || \
+ ("%{Tmp-IP-Address-0[2]}" != '')) {
test_fail
}
# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
if (("%{Tmp-IP-Address-0[0]}" != '192.0.2.2') || \
- ("%{Tmp-IP-Address-0[1]}" != '')) {
+ ("%{Tmp-IP-Address-0[1]}" != '')) {
test_fail
}
&Tmp-String-0 := "%(config:modules.test.boolean)"
if (&Tmp-String-0 != "no") {
- test_fail
+ test_fail
}
&Tmp-String-0 := "test"
&Tmp-Integer-0 := "%(config:modules.%{Tmp-String-0}.integer)"
if (&Tmp-Integer-0 != 1) {
- test_fail
+ test_fail
}
success
\ No newline at end of file
&Tmp-Octets-0 := 0x520d0103abcdef0206010203040506
if ("%(decode.dhcpv4:%{Tmp-Octets-0})" != 2) {
- test_fail
+ test_fail
}
debug_request
if ( &Relay-Agent-Information.Circuit-Id != 0xabcdef ) {
- test_fail
+ test_fail
}
if ( &Relay-Agent-Information.Remote-Id != 0x010203040506 ) {
- test_fail
+ test_fail
}
&Tmp-Octets-1 := "%(encode.dhcpv4:&request[*])"
if ( &Tmp-Octets-1 != 0x520d0103abcdef0206010203040506 ) {
- test_fail
+ test_fail
}
debug_control
-update control {
+update control {
&Tmp-String-0 = "foo"
}
-update control {
+update control {
&Tmp-String-1 := `/bin/echo hello 1234:%{control.Tmp-String-0} world`
}
test_fail
}
-update control {
+update control {
&Tmp-String-1 := `/bin/echo hello %{control.Tmp-String-0}:1234 world`
}
# PRE: update
#
update request {
- &Tmp-String-0 := '9870'
- &Tmp-String-1 := '98709870'
- &Tmp-String-2 := '184467440737095516157'
- &Tmp-Octets-0 := 0x39383731
- &Tmp-Octets-1 := 0x3938373139383731
- &Tmp-Octets-2 := 0x393837313938373139383731
- &Tmp-IP-Address-0 := 57.56.55.50
- &Tmp-Date-0 := 959985459
- &Tmp-Integer-0 := 959985460
- &Tmp-Cast-IfId := '0000:0000:3938:3737'
- &Tmp-Cast-IPv6Addr := '::3938:3738'
+ &Tmp-String-0 := '9870'
+ &Tmp-String-1 := '98709870'
+ &Tmp-String-2 := '184467440737095516157'
+ &Tmp-Octets-0 := 0x39383731
+ &Tmp-Octets-1 := 0x3938373139383731
+ &Tmp-Octets-2 := 0x393837313938373139383731
+ &Tmp-IP-Address-0 := 57.56.55.50
+ &Tmp-Date-0 := 959985459
+ &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-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-String-2 := "%(integer:%{Tmp-IP-Address-0})"
- &Tmp-String-3 := "%(integer:%{Tmp-Date-0})"
- &Tmp-String-4 := "%(integer:%{Tmp-Integer-0})"
- &Tmp-String-6 := "%(integer:%{Tmp-Cast-Ifid})"
- &Tmp-String-7 := "%(integer:%{Tmp-Cast-IPv6Addr})"
- &Tmp-String-8 := "%(integer:%{Tmp-Cast-IPv6Prefix})"
+ &Tmp-String-2 := "%(integer:%{Tmp-IP-Address-0})"
+ &Tmp-String-3 := "%(integer:%{Tmp-Date-0})"
+ &Tmp-String-4 := "%(integer:%{Tmp-Integer-0})"
+ &Tmp-String-6 := "%(integer:%{Tmp-Cast-Ifid})"
+ &Tmp-String-7 := "%(integer:%{Tmp-Cast-IPv6Addr})"
+ &Tmp-String-8 := "%(integer:%{Tmp-Cast-IPv6Prefix})"
}
# IP Address
test_fail
}
update request {
- &Tmp-String-0 := "%(integer:%{Tmp-Cast-Byte})"
- &Tmp-String-1 := "%(integer:%{Tmp-Cast-Short})"
- &Tmp-uint64-2 := "%(integer:%{Tmp-Cast-Ether})"
- &Tmp-String-3 := "%(integer:%{Tmp-Cast-Integer64})"
- &Tmp-String-4 := "%(integer:%{Tmp-Cast-IPv4Prefix})"
+ &Tmp-String-0 := "%(integer:%{Tmp-Cast-Byte})"
+ &Tmp-String-1 := "%(integer:%{Tmp-Cast-Short})"
+ &Tmp-uint64-2 := "%(integer:%{Tmp-Cast-Ether})"
+ &Tmp-String-3 := "%(integer:%{Tmp-Cast-Integer64})"
+ &Tmp-String-4 := "%(integer:%{Tmp-Cast-IPv4Prefix})"
}
# byte
#
update request {
- &Tmp-String-0 := "%(interpreter:.filename)"
- &Tmp-Integer-0 := "%(interpreter:.line)"
- &Tmp-String-1 := "%(interpreter:.name)"
- &Tmp-String-2 := "%(interpreter:.type)"
+ &Tmp-String-0 := "%(interpreter:.filename)"
+ &Tmp-Integer-0 := "%(interpreter:.line)"
+ &Tmp-String-1 := "%(interpreter:.name)"
+ &Tmp-String-2 := "%(interpreter:.type)"
}
if (&Tmp-String-0 != "src/tests/keywords/xlat-interpreter") {
- test_fail
+ test_fail
}
if (&Tmp-String-1 != "request") {
- test_fail
+ test_fail
}
if (&Tmp-String-2 != "update") {
- test_fail
+ test_fail
}
if (&Tmp-Integer-0 != 8) {
- test_fail
+ test_fail
}
success
#
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# SoH-Supported not set - should be no response
if ("%{control.Tmp-String-0}" != "") {
- test_fail
+ test_fail
}
update request {
- &SoH-Supported := yes
- &SoH-MS-Machine-OS-release := 0
- &SoH-MS-Machine-OS-build := 6001
- &SoH-MS-Machine-SP-version := 1
- &SoH-MS-Machine-SP-release := 0
+ &SoH-Supported := yes
+ &SoH-MS-Machine-OS-release := 0
+ &SoH-MS-Machine-OS-build := 6001
+ &SoH-MS-Machine-SP-version := 1
+ &SoH-MS-Machine-SP-release := 0
}
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# SoH-MS-Machine-OS-vendor not set - should be no response
if ("%{control.Tmp-String-0}" != "") {
- test_fail
+ test_fail
}
update request {
- &SoH-Supported := yes
- &SoH-MS-Machine-OS-vendor := Microsoft
+ &SoH-Supported := yes
+ &SoH-MS-Machine-OS-vendor := Microsoft
}
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# OS version not set
if ("%{control.Tmp-String-0}" != "Windows unknown") {
- test_fail
+ test_fail
}
update request {
- &SoH-MS-Machine-OS-version := 6
+ &SoH-MS-Machine-OS-version := 6
}
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# Complete set of data should match a real version of Windows
if ("%{control.Tmp-String-0}" != "Windows Vista / Server 2008 6.0.6001 sp 1.0" ) {
- test_fail
+ test_fail
}
update request {
- &SoH-MS-Machine-OS-release := 5
+ &SoH-MS-Machine-OS-release := 5
}
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# Version and Release combination that does not exist
if ("%{control.Tmp-String-0}" != "Windows Other 6.5.6001 sp 1.0") {
- test_fail
+ test_fail
}
update request {
- &SoH-MS-Machine-OS-version := 8
- &SoH-MS-Machine-OS-release := 0
+ &SoH-MS-Machine-OS-version := 8
+ &SoH-MS-Machine-OS-release := 0
}
update control {
- &Tmp-String-0 := %(soh:OS)
+ &Tmp-String-0 := %(soh:OS)
}
# Version that does not exist
if ("%{control.Tmp-String-0}" != "Windows Other 8.0.6001 sp 1.0") {
- test_fail
+ test_fail
}
debug_control