Debian Codegraph @

src/tests/keywords/xlat-list

raw
1 #
2 # PRE: update
3 #
4 update control {
5 control !* ANY
6 }
7
8 update control {
9 Tmp-IP-Address-0 := 192.0.2.1
10 Tmp-IP-Address-0 += 192.0.2.2
11 }
12
13 if ("%{control:[#]}" != 2) {
14 update {
15 reply:Filter-Id += 'fail 0'
16 }
17 }
18
19 debug_control
20
21 if (("%{control:[0]}" != 192.0.2.1) || ("%{control:[1]}" != 192.0.2.2)) {
22 update {
23 reply:Filter-Id += 'fail 1'
24 }
25 }
26
27 if (("%{control:[n]}" != 192.0.2.2)) {
28 update {
29 reply:Filter-Id += 'fail 1a'
30 }
31 }
32
33 if ("%{control:[*]}" != '192.0.2.1,192.0.2.2') {
34 update {
35 reply:Filter-Id += 'fail 2'
36 }
37 }
38
39 # Try calling these xlats in mapping too, they may get optimised to VPTs which is a
40 # different code path.
41 update request {
42 Tmp-IP-Address-1 += "%{control:[1]}"
43 Tmp-IP-Address-1 += "%{control:[0]}"
44 Tmp-String-0 = "%{control:[*]}"
45 Tmp-Integer-0 = "%{control:[#]}"
46 }
47
48 if (Tmp-String-0 != '192.0.2.1,192.0.2.2') {
49 update {
50 reply:Filter-Id += 'fail 3'
51 }
52 }
53
54 if (Tmp-Integer-0 != 2) {
55 update {
56 reply:Filter-Id += 'fail 4'
57 }
58 }
59
60 # Boilerplate junk
61 update {
62 control:Cleartext-Password := 'hello'
63 reply:Filter-Id := 'filter'
64 }