Debian Codegraph @

src/tests/keywords/sha1

raw
1 #
2 # PRE: update if
3 #
4 update {
5 control:Cleartext-Password := 'hello'
6 request:Tmp-String-0 := "This is a string\n"
7 request:Tmp-Octets-0 := 0x000504030201
8 request:Tmp-String-1 := "what do ya want for nothing?"
9 request:Tmp-String-2 := "Jefe"
10 }
11
12 update reply {
13 Filter-Id := 'filter'
14 }
15
16 #
17 # Put "This is a string" into a file and call "sha1sum" on it.
18 # You should get this string.
19 #
20 if ("%{sha1:This is a string\n}" != 'cc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c') {
21 update reply {
22 Filter-Id += 'fail 1'
23 }
24 }
25
26 if ("%{sha1:&Tmp-String-0}" != 'cc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c') {
27 update reply {
28 Filter-Id += 'fail 2'
29 }
30 }
31
32 if ("%{sha1:&request:Tmp-String-0}" != 'cc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c') {
33 update reply {
34 Filter-Id += 'fail 3'
35 }
36 }
37
38 if ("%{sha1:%{Tmp-String-0}}" != 'cc7edf1ccc4bdf1e0ec8f72b95388b65218ecf0c') {
39 update reply {
40 Filter-Id += 'fail 4'
41 }
42 }
43
44 #
45 # SHA1 should also be able to cope with references to octet attributes
46 #
47 if ("%{sha1:&request:Tmp-Octets-0}" != '365b244645fe7294dff062174996572319d5a82c') {
48 update reply {
49 Filter-Id += 'fail 5'
50 }
51 }
52
53 #
54 # SHA1 HMAC with attribute references
55 #
56 if ("%{hmacsha1:&Tmp-String-1 &Tmp-String-2}" != 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79') {
57 update reply {
58 Filter-Id += 'fail 6'
59 }
60 }