blob: c9c2d156ca5e682feabb43832622f1463db4e6f2 (
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# PRE: if
#
# Non matching on attribute ref
if (User-Name !~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])/) {
update reply {
Filter-Id += 'Fail 0'
}
}
# Matching on xlat expanded value
if ("%{User-Name}" !~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])/) {
update reply {
Filter-Id += 'Fail 1'
}
}
# Matching on attribute ref with capture groups
if (User-Name =~ /^([0-9])_([0-9])?_([0-9]*)_([0-9]+)_([^_])_(6)_([7-8])/) {
# Test all the capture groups
update {
reply:User-Name := "%{7}_%{6}_%{5}_%{4}_%{3}_%{2}_%{1}_%{0}"
}
}
else {
update reply {
Filter-Id += 'Fail 2'
}
}
# Checking capture groups are cleared out correctly
if (User-Name =~ /^([0-9])_/) {
if ("%{0}%{1}%{2}%{3}%{4}%{5}%{6}%{7}" != '1_1') {
update reply {
Filter-Id += 'Fail 3'
}
}
}
else {
update reply {
Filter-Id += 'Fail 3.5'
}
}
# Checking capture groups are cleared out correctly when there are no matches
if (User-Name =~ /^./) {
if ("%{0}%{1}%{2}%{3}%{4}%{5}%{6}%{7}" != '1') {
update reply {
Filter-Id += 'Fail 4'
}
}
}
else {
update reply {
Filter-Id += 'Fail 4.5'
}
}
# compiled - ref - insensitive
if (Calling-Station-Id !~ /:roamyroam$/i) {
update reply {
Filter-Id += 'Fail 5'
}
}
# compiled - expansion - insensitive
if ("%{Calling-Station-Id}" !~ /:roamyroam$/i) {
update reply {
Filter-Id += 'Fail 6'
}
}
# compiled - enum - ref - insensitive
if (Service-Type !~ /^framed-user$/i) {
update reply {
Filter-Id += 'Fail 7'
}
}
# compiled - enum - expansion - insensitive
if ("%{Service-Type}" !~ /^framed-user$/i) {
update reply {
Filter-Id += 'Fail 8'
}
}
# compiled - enum - ref
if (Service-Type =~ /^framed-user$/) {
update reply {
Filter-Id += 'Fail 9'
}
}
update request {
Tmp-String-0 := "foo\nbar"
}
# compiled - ref - multiline
if (&Tmp-String-0 !~ /^foo$/m) {
update reply {
Filter-Id += 'Fail 14'
}
}
# compiled - ref - non-multiline
if (&Tmp-String-0 =~ /^foo$/) {
update reply {
Filter-Id += 'Fail 15'
}
}
# compiled - ref - non-multiline
# Not all POSIX implementations support the \n character classes
# so only run this test if the server was built with libpcre.
if (("${feature.regex-pcre}" == 'yes') && (&Tmp-String-0 !~ /^foo\nbar$/)) {
update reply {
Filter-Id += 'Fail 16'
}
}
# compiled - ref - multiline
if (&Tmp-String-0 !~ /^bar$/m) {
update reply {
Filter-Id += 'Fail 17'
}
}
# compiled - ref - multiline - sensitive
if (&Tmp-String-0 =~ /^BAR$/m) {
update reply {
Filter-Id += 'Fail 17'
}
}
# compiled - ref - multiline - insensitive
if (&Tmp-String-0 !~ /^BAR$/mi) {
update reply {
Filter-Id += 'Fail 17'
}
}
# compiled - ref - multiline - insensitive (flag order reversed)
if (&Tmp-String-0 !~ /^BAR$/im) {
update reply {
Filter-Id += 'Fail 18'
}
}
|