Merge tag 'release_3_0_12' into branch moonshot-fr-3.0.12-upgrade.
[freeradius.git] / src / tests / keywords / update-filter
1 #
2 #  PRE: update
3 #
4 update control {
5         Tmp-Integer-0 := 5
6         Tmp-Integer-0 += 10
7         Tmp-Integer-0 += 15
8         Tmp-Integer-0 += 20
9         Tmp-String-0 := 'foo'
10         Tmp-String-0 += 'baz'
11         Tmp-String-0 += 'boink'
12 }
13
14 #
15 #  Reset the request list
16 #
17 update {
18         &request: !* ANY
19         &request: += &control:[*]
20 }
21
22 debug_request
23
24 #
25 #  Only matching attributes of the specified type should remain
26 #
27 update request {
28         &Tmp-Integer-0 == 10
29 }
30
31 if (&Tmp-Integer-0[0] != 10) {
32         update reply {
33                 Filter-Id += "fail 1"
34         }
35 }
36
37 if ("%{Tmp-Integer-0[#]}" != 1) {
38         update reply {
39                 Filter-Id += "fail 2"
40         }
41 }
42
43 if ("%{Tmp-String-0[#]}" != 3) {
44         update reply {
45                 Filter-Id += "fail 3"
46         }
47 }
48
49 debug_request
50
51 #
52 #  Only matching attributes of the specified type should remain
53 #
54 update request {
55         &Tmp-String-0 == 'baz'
56 }
57
58 if (&Tmp-String-0[0] != 'baz') {
59         update reply {
60                 Filter-Id += "fail 4"
61         }
62 }
63
64 if ("%{Tmp-String-0[#]}" != 1) {
65         update reply {
66                 Filter-Id += "fail 5"
67         }
68 }
69
70 update {
71         control:Auth-Type := Accept
72         reply:Filter-Id := "filter"
73 }
74
75 debug_request