3 source import-common.sh
13 passphrase_file=`pwd`/acl.key
19 echo "Test 1. Invoking user '$USER' with _acl 'nobody'."
20 echo -ne 'LIST --all --with-target' | pwmc
$PWMC_ARGS acl
> result
21 cmp acl.result1 result
25 echo "Test 2. Retrieve content (fail)."
27 echo -ne 'GET c' | pwmc
$PWMC_ARGS acl
> result
28 if [ ${PIPESTATUS[1]} == 0 ]; then
29 echo "The previous command should have failed. Stopping."
37 echo "Test 3. Create new path."
38 echo -ne 'acl\tpath\tacl path value' | pwmc
$PWMC_ARGS --inquire STORE
-S acl
41 echo "Test 4. Delete _acl attribute of child (owner)."
42 echo -ne 'ATTR DELETE _acl acl\tpath' | pwmc
$PWMC_ARGS -S acl
45 echo "Test 5. Access child (_acl re-added)."
46 echo -ne 'ATTR LIST acl\tpath' | pwmc
$PWMC_ARGS acl
> result
51 echo "Test 6. Change ownership of child element."
52 echo -ne "ATTR SET _acl acl\tpath nobody,$USER" | pwmc
$PWMC_ARGS -S acl
55 echo "Test 7. Access child (not owner)."
56 echo -ne 'ATTR LIST acl\tpath' | pwmc
$PWMC_ARGS acl
> result
61 echo "Test 8. Delete child element (fail)."
63 echo -ne 'DELETE acl\tpath' | pwmc
$PWMC_ARGS acl
64 if [ ${PIPESTATUS[1]} == 0 ]; then
65 echo "The previous command should have failed. Stopping."
71 echo "Test 9. Change ownership of child element (fail)."
73 echo -ne "ATTR SET _acl acl\tpath $USER" | pwmc
$PWMC_ARGS -S acl
74 if [ ${PIPESTATUS[1]} == 0 ]; then
75 echo "The previous command should have failed. Stopping."
81 echo "Test 10. Create child element content (fail)."
83 echo -ne 'acl\tpath\tupdate' | pwmc
$PWMC_ARGS --inquire STORE acl
84 if [ ${PIPESTATUS[1]} == 0 ]; then
85 echo "The previous command should have failed. Stopping."
91 echo "Test 11. Create parent element content."
92 echo -ne 'acl\tacl value' | pwmc
$PWMC_ARGS --inquire STORE
-S acl
93 echo -ne 'GET acl' | pwmc
$PWMC_ARGS acl
> result
94 cmp acl.result11 result
99 echo "Test 13. List attributes of un-owned root."
100 echo -ne 'ATTR LIST nouser' | pwmc
$PWMC_ARGS acl
> result
101 cmp acl.result13 result
105 echo "Test 14. List attributes of owned child of un-owned parent (fail)."
106 echo -ne 'attr\ta\tb\tvalue' | pwmc
$PWMC_ARGS --inquire STORE
-S acl
107 echo -ne 'ATTR SET _acl attr\ta nobody' | pwmc
$PWMC_ARGS -S acl
109 echo -ne "ATTR LIST attr\ta\tb" | pwmc
$PWMC_ARGS acl
110 if [ ${PIPESTATUS[1]} == 0 ]; then
111 echo "The previous command should have failed. Stopping."
117 echo "Test 15. List attributes of un-owned child."
118 echo -ne 'ATTR LIST attr\ta' | pwmc
$PWMC_ARGS acl
> /dev
/null
121 echo "Test 16. List attributes of un-owned root with target."
122 echo -ne 'ATTR LIST b' | pwmc
$PWMC_ARGS acl
> result
123 cmp acl.result16 result
127 echo "Test 17. List attributes of un-owned child with un-owned root target (fail)."
129 echo -ne "ATTR LIST b\tb" | pwmc
$PWMC_ARGS acl
130 if [ ${PIPESTATUS[1]} == 0 ]; then
131 echo "The previous command should have failed. Stopping."
137 echo "Test 18. List non-existant child of un-owned parent."
138 echo -ne 'new\ta\tb\tvalue' | pwmc
$PWMC_ARGS --inquire STORE
-S acl
139 echo -ne 'new2\ta\tb\tvalue' | pwmc
$PWMC_ARGS --inquire STORE
-S acl
140 echo -ne 'ATTR SET target new\ta new2\ta' | pwmc
$PWMC_ARGS -S acl
141 echo -ne 'ATTR SET _acl new2\ta nobody' | pwmc
$PWMC_ARGS -S acl
142 echo -ne 'LIST --all --with-target --verbose new\ta\tnon-existant' | pwmc
$PWMC_ARGS acl
> result
143 cmp acl.result18 result
147 echo "Test 19. List literal children of un-owned parent with target."
148 echo -ne 'LIST --all --verbose --with-target new' | pwmc
$PWMC_ARGS acl
> result
149 cmp acl.result19 result
153 echo "Test 20. Create target to visible restricted root."
154 echo -ne 'ATTR SET target zzz\ta a' | pwmc
$PWMC_ARGS -S acl
155 echo -ne 'LIST --all --verbose --with-target' | pwmc
$PWMC_ARGS acl
> result
156 cmp acl.result20 result
160 echo "Test 21. Create target to visible restricted child."
161 echo -ne 'ATTR SET _acl zzz\t!a non-existant' | pwmc
$PWMC_ARGS -S acl
162 echo -ne 'ATTR SET target newzzz\tb zzz\t!a' | pwmc
$PWMC_ARGS -S acl
163 echo -ne 'LIST --all --verbose --with-target' | pwmc
$PWMC_ARGS acl
> result
164 cmp acl.result21 result