summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/escape
blob: 5d0b3bc2fd29e4a6161b3dedbf23012ea6195e7a (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
#
#  PRE: update if xlat-attr-index
#
update request {
        control:Cleartext-Password := 'hello'
        reply:Filter-Id := "filter"

	Tmp-String-0 := '@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /'
	Tmp-String-1 := '±§#$%^&+={[}];<,>?`|"'
	Tmp-String-2 := '™¥¤'
	Tmp-String-3 := '=C2=B1=C2=A7=23=24=25=5E=26=2B=3D=7B=5B=7D=5D=3B=3C=2C=3E=3F=60=7C=22'
	Tmp-String-4 := '=E2=84=A2=C2=A5=C2=A4'
	Tmp-String-5 := '=40=61=62=63=64=65=66=67'

	# Mixture of safe and unsafe chars
	Tmp-String-6 := 'ŒČÿ'
	Tmp-String-7 := 'Œ=C4=8Cÿ'
}

if (<string>"%{escape:%{request:Tmp-String-0}}" != &Tmp-String-0) {
	update reply {
		Filter-Id += 'Fail 1'
	}
}

if (<string>"%{escape:%{request:Tmp-String-1}}" != &Tmp-String-3) {
	update reply {
		Filter-Id += 'Fail 2'
	}
}

if (<string>"%{escape:%{request:Tmp-String-2}}" != &Tmp-String-4) {
	update reply {
		Filter-Id += 'Fail 3'
	}
}

if (<string>"%{unescape:%{request:Tmp-String-0}}" != &Tmp-String-0) {
	update reply {
		Filter-Id += 'Fail 4'
	}
}

if (<string>"%{unescape:%{request:Tmp-String-3}}" != "%{Tmp-String-1}") {
	update reply {
		Filter-Id += 'Fail 5'
	}
}

if (<string>"%{unescape:%{request:Tmp-String-4}}" != &Tmp-String-2) {
	update reply {
		Filter-Id += 'Fail 6'
	}
}

if (<string>"%{escape:%{request:Tmp-String-6}}" != &Tmp-String-7) {
	update reply {
		Filter-Id += 'Fail 7'
	}
}

if (<string>"%{unescape:%{request:Tmp-String-7}}" != &Tmp-String-6) {
	update reply {
		Filter-Id += 'Fail 8'
	}
}