blob: 967656df14721c95a52e53a549706b66a089db67 (
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
|
#
# PRE: update if xlat-attr-index
#
update request {
control:Cleartext-Password := 'hello'
Tmp-Octets-0 := 0x69206861766520736361727920656d626564646564207468696e67730020696e73696465206d65
Tmp-Octets-1 := 0x30783031013078303707307830410A307830440D222230786230b0C2b0
Tmp-String-0 := "i have scary embedded things\000 inside me"
Tmp-String-0 += "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°"
# and again with single quoted strings.
# unlike other languages, \r, \t, and \n have meaning inside of 'string'
Tmp-String-1 := 'i have scary embedded things\000 inside me'
Tmp-String-1 += '0x01\0010x07\0070x0A\n0x0D\r""0xb0\260°'
Tmp-String-2 := 'i have scary embedded things\000 inside me'
Tmp-String-2 += "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°"
reply:Filter-Id := "filter"
}
if ("%{length:&Tmp-String-0}" != 39) {
update reply {
Filter-Id += 'fail l-0'
}
}
if ("%{length:&Tmp-String-1}" != 42) {
update reply {
Filter-Id += 'fail l-1'
}
}
if ("%{string:Tmp-Octets-0}" != "i have scary embedded things\000 inside me") {
update reply {
Filter-Id += 'fail 1'
}
}
if (&Tmp-String-0 != "i have scary embedded things\000 inside me") {
update reply {
Filter-Id += 'fail 2'
}
}
if ("%{string:Tmp-Octets-1}" != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") {
update reply {
Filter-Id += 'fail 3'
}
}
if ("%{Tmp-String-0[0]}" != "i have scary embedded things\000 inside me") {
update reply {
Filter-Id += 'fail 4'
}
}
if ("%{Tmp-String-0[1]}" != "0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") {
update reply {
Filter-Id += 'fail 5'
}
}
# And another slightly different codepath...
if ("%{Tmp-String-0[*]}" != "i have scary embedded things\000 inside me,0x01\0010x07\0070x0A\n0x0D\r\"\"0xb0\260°") {
update reply {
Filter-Id += 'fail 6'
}
}
if (&Tmp-String-0[0] != &Tmp-String-0[0]) {
update reply {
Filter-Id += 'fail 7'
}
}
#
# This seems weird... double escapes for most things, but single escapes
# for the quotation marks.
#
if ("%{Tmp-String-2[1]}" != "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°") {
update reply {
Filter-Id += 'fail 8'
}
}
#
# And again as an attribute reference
#
if (&Tmp-String-2[1] != "0x01\0010x07\0070x0A\n0x0D\r''0xb0\260°") {
update reply {
Filter-Id += 'fail 9'
}
}
|