blob: 3fd1f94b1ce5fd806bfe10d5b571b35d0006cc7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#
# PRE: update
#
# Remove all attributes in a list
#
update {
control:Cleartext-Password := 'hello'
reply:Filter-Id := 'filter'
}
update {
request:Tmp-String-0 := 'foobarbaz'
request:Tmp-Integer-0 := 123456789
request:Tmp-IP-Address-0 := 192.0.2.1
request:Tmp-IP-Address-0 += 192.0.2.2
request:Tmp-IP-Address-0 += 192.0.2.3
request:Tmp-IP-Address-0 += 192.0.2.4
control:Tmp-IP-Address-0 := 192.0.2.1
control:Tmp-IP-Address-0 += 192.0.2.3
}
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)) {
update reply {
Filter-Id += 'fail 0'
}
}
# Remove Tmp-IP-Address-0 with a specific value
update {
request:Tmp-IP-Address-0 -= 192.0.2.1
}
# 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]}" != '')) {
update reply {
Filter-Id += 'fail 1'
}
}
# Remove Tmp-IP-Address-0 with a specific value (somewhere in the middle)
update {
request:Tmp-IP-Address-0 -= 192.0.2.3
}
# 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]}" != '')) {
update reply {
Filter-Id += 'fail 2'
}
}
# Remove Tmp-IP-Address-0 with a specific value (which doesn't exist)
update {
request:Tmp-IP-Address-0 -= 192.0.2.3
}
# 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]}" != '')) {
update reply {
Filter-Id += 'fail 3'
}
}
# Remove Tmp-IP-Address-4 (which doesn't exist - more to check for SEGV/assert)
update {
request:Tmp-IP-Address-4 -= 192.0.2.3
}
# Remove Tmp-IP-Address-0 with a specific value
update {
request:Tmp-IP-Address-0 -= 192.0.2.4
}
# 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]}" != '')) {
update reply {
Filter-Id += 'fail 4'
}
}
# Remove Tmp-IP-Address-0 with a specific value
update {
request:Tmp-IP-Address-0 -= 192.0.2.2
}
# Only the 1st, and 3rd Tmp-IP-Address attributes should still be in the list
if ("%{Tmp-IP-Address-0[0]}" != '') {
update reply {
Filter-Id += 'fail 5'
}
}
# Non Tmp-IP-Address-0 address attributes should still be in the request list
if ((Tmp-String-0 != 'foobarbaz') || (Tmp-Integer-0 != 123456789)) {
update reply {
Filter-Id += 'fail 6'
}
}
# But there should still be some in the control list
if (("%{control:Tmp-IP-Address-0[0]}" != 192.0.2.1) || ("%{control:Tmp-IP-Address-0[1]}" != 192.0.2.3)) {
update {
Filter-Id += 'fail 7'
}
}
|