3 # Tests for per-element ACL's.
8 .
$AM_SRCDIR/import-common.sh
12 cat >$OUTDIR/config
<<EOF
18 passphrase_file=$WDIR/passphrase.key
25 test_result
$test_n $? acl \
26 "LIST: Invoking user '$USER' with _acl 'nobody'."
30 run_pwmc
"acl" >result
$DEVNULL <<EOF
33 test_failure
$test_n $?
536903681 "GET: Element content permission error."
37 run_pwmc
"--inquire STORE -S acl" $DEVNULL <<EOF
38 acl path acl path value
40 test_result
$test_n $?
"STORE: Create new element path."
44 run_pwmc
"-S acl" $DEVNULL <<EOF
45 ATTR DELETE _acl acl path
47 test_result
$test_n $?
"ATTR: Delete _acl attribute of child (owner)."
51 run_pwmc
"acl" >result
$DEVNULL <<EOF
59 test_result
$test_n $e "ATTR: Access child (_acl re-added)."
63 run_pwmc
"-S acl" $DEVNULL <<EOF
64 ATTR SET _acl acl path nobody,${USER}
66 test_result
$test_n $?
"ATTR: Change ownership of child element."
70 run_pwmc
"acl" >result
$DEVNULL <<EOF
78 test_result
$test_n $e "ATTR: Access child (not owner)."
82 run_pwmc
"acl" $DEVNULL <<EOF
85 test_failure
$test_n $?
536903681 "DELETE: Element permission error."
89 run_pwmc
"-S acl" $DEVNULL <<EOF
90 ATTR SET _acl acl path $USER
92 test_failure
$test_n $?
536903681 "ATTR: Deny change of ownership by non-owner."
96 run_pwmc
"--inquire STORE acl" $DEVNULL <<EOF
99 test_failure
$test_n $?
536903681 "STORE: Deny create child element by non-owner."
103 run_pwmc
"--inquire STORE --inquire-line 'acl acl value' -S acl" $DEVNULL <<EOF
106 if [ $e -eq 0 ]; then
107 run_pwmc
"acl" >result
$DEVNULL <<EOF
112 test_result
$test_n $e acl
"Create parent element content."
116 run_pwmc
"acl" >result
$DEVNULL <<EOF
117 ATTR LIST no-such-user
119 test_result
$test_n $? acl
"List attributes of un-owned root."
123 run_pwmc
"--inquire STORE -S acl" $DEVNULL <<EOF
127 if [ $e -eq 0 ]; then
128 run_pwmc
"-S acl" $DEVNULL <<EOF
129 ATTR SET _acl attr a nobody
132 if [ $e -eq 0 ]; then
133 run_pwmc
"acl" $DEVNULL <<EOF
139 test_failure
$test_n $e 536903681 "Deny attribute list of owned child of un-owned parent."
143 run_pwmc
"acl >/dev/null" $DEVNULL <<EOF
146 test_result
$test_n $?
"List attributes of un-owned child."
150 run_pwmc
"acl" >result
$DEVNULL <<EOF
153 test_result
$test_n $? acl
"List attributes of un-owned root with target."
157 run_pwmc
"acl >/dev/null" $DEVNULL <<EOF
160 test_failure
$test_n $?
536903681 "Deny list attributes of un-owned child with un-owned root target."
164 run_pwmc
"--inquire STORE -S acl" $DEVNULL <<EOF
168 if [ $e -eq 0 ]; then
169 run_pwmc
"--inquire STORE -S acl" $DEVNULL <<EOF
173 if [ $e -eq 0 ]; then
174 run_pwmc
"-S acl" $DEVNULL <<EOF
175 ATTR SET _target new a new2 a
178 if [ $e -eq 0 ]; then
179 run_pwmc
"-S acl" $DEVNULL <<EOF
180 ATTR SET _acl new2 a nobody
183 if [ $e -eq 0 ]; then
184 list_recurse acl
"new a non-existant"
190 test_result
$test_n $e acl
"LIST: Non-existent child of un-owned parent."
194 list_recurse acl
"new"
195 test_result
$test_n $? acl
"LIST: Children of un-owned parent with target."
199 run_pwmc
"-S acl" $DEVNULL <<EOF
200 ATTR SET _target zzz a a
203 test_result
$test_n $? acl
"ATTR: Create target to visible restricted root."
207 run_pwmc
"-S acl" $DEVNULL <<EOF
208 ATTR SET _acl zzz a non-existant
211 if [ $e -eq 0 ]; then
212 run_pwmc
"-S acl" $DEVNULL <<EOF
213 ATTR SET _target newzzz b zzz a
218 test_result
$test_n $e acl
"ATTR: Create target to visible restricted child."
222 run_pwmc
"acl" >result
$DEVNULL <<EOF
225 test_result
$test_n $? acl
"ATTR: Get attribute of element which denies permission."
229 run_pwmc
"acl >/dev/null" $DEVNULL <<EOF
230 ATTR GET _acl zzz a blah
232 test_failure
$test_n $?
536903681 "ATTR: Get attribute of child element which denies permission."
236 run_pwmc
"acl" $DEVNULL <<EOF
239 test_failure
$test_n $?
536903787 "ATTR: Deny delete attribute of non-owner."
243 run_pwmc
"acl >/dev/null" $DEVNULL <<EOF
244 ATTR SET blahblah c value
246 test_failure
$test_n $?
536903681 "ATTR: Deny creation of new attribute for non-owner."
250 run_pwmc
"acl >/dev/null" $DEVNULL <<EOF
251 ATTR SET _mtime c 1234
253 test_failure
$test_n $?
536903787 "ATTR: Deny overwrite of existing attribute for non-owner."