summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/md4
blob: 7e9b1ffcdf28ea068f57b3568b6c140e19ed9eee (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
#
# PRE: update if
#
update reply {
	Filter-Id := "filter"
}

update {
       control:Cleartext-Password := 'hello'
       request:Tmp-String-0 := "This is a string\n"
       request:Tmp-Octets-0 := 0x000504030201
       request:Tmp-String-1 := "what do ya want for nothing?"
       request:Tmp-String-2 := "Jefe"
}

#
#  Put "This is a string" into a file and call "md5sum" on it.
#  You should get this string.
#
if ("%{md4:This is a string\n}" != '1f60d5cd85e17bfbdda7c923822f060c') {
	update reply {
		Filter-Id += 'fail 1'
	}
}

if ("%{md4:&Tmp-String-0}" != '1f60d5cd85e17bfbdda7c923822f060c') {
	update reply {
		Filter-Id += 'fail 2'
	}
}

if ("%{md4:&request:Tmp-String-0}" != '1f60d5cd85e17bfbdda7c923822f060c') {
	update reply {
		Filter-Id += 'fail 3'
	}
}

if ("%{md4:%{request:Tmp-String-0}}" != '1f60d5cd85e17bfbdda7c923822f060c') {
	update reply {
		Filter-Id += 'fail 4'
	}
}

#
#  MD4 should also be able to cope with references to octet attributes
#
if ("%{md4:&request:Tmp-Octets-0}" != 'ac3ed17b3cf19ec38352ec534a932fc6') {
	update reply {
		Filter-Id += 'fail 5'
	}
}

if ("%{md4:&Tmp-String-1}" != 'f7b44afb9cfdc877aa99d44654fe808b') {
	update reply {
		Filter-Id += 'fail 6'
	}
}