blob: b9a0f733f67bc161ef7a4bbf5a5941e1b0a03b03 (
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
|
#
# PRE: update if redundant
#
update control {
Cleartext-Password := 'hello'
}
update reply {
Filter-Id := "filter"
}
#
# Exec with script output to attribute
#
update request {
Tmp-String-0 = `/bin/sh -c "echo 'foo bar baz'"`
}
if (Tmp-String-0 != "foo bar baz") {
update reply {
Filter-Id += "fail 1"
}
}
#
# Exec with output to list (single attribute)
#
update {
request: = `/bin/sh -c "echo Tmp-String-0 := foo"`
}
if (Tmp-String-0 != 'foo') {
update reply {
Filter-Id += "fail 2"
}
}
#
# Exec with output to list (multiple attributes)
#
update {
request: = `/bin/sh -c 'echo Tmp-String-0 := foo, Tmp-String-1 := bar'`
}
if ((Tmp-String-0 != 'foo') || (Tmp-String-1 != 'bar')) {
update reply {
Filter-Id += "fail 3"
}
}
#
# Failed exec (malformed attributes) - check no attributes are added
#
update request {
Tmp-String-0 !* ANY
Tmp-String-1 !* ANY
}
redundant {
group {
update {
request: = `/bin/sh -c 'echo Tmp-String-0 := foo, Tmp-String-1 ?= bar'`
}
}
ok
}
if (Tmp-String-0 || Tmp-String-1) {
update reply {
Filter-Id += "fail 4"
}
}
#
# Exec with output to list - error code
#
update request {
Tmp-String-0 !* ANY
Tmp-String-1 !* ANY
}
redundant {
group {
update {
request: = `/bin/sh -c 'echo Tmp-String-0 := foo; exit 64'`
}
}
ok
}
if (Tmp-String-0) {
update reply {
Filter-Id += "fail 5"
}
}
|