7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like. Any license provided herein, whether implied or
21 # otherwise, applies only to this software file. Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA 94043, or:
34 # For further information regarding this notice, see:
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
43 echo "QA output created by $seq"
48 status=1 # FAILure is the default!
49 trap "_cleanup; exit \$status" 0 1 2 3 15
51 # get standard environment, filters and checks
58 rm -rf $TEST_DIR/$seq.dir1
63 ls -ln $* | awk '{ print $1, $3, $4, $NF }'
67 # minimal access ACL has ACEs: USER_OBJ, GROUP_OBJ, OTHER_OBJ
68 # This is set with chacl(1) and can be changed by chmod(1).
70 # Test that this is being set for ACL and for std unix permissions
71 # Test that we can get back the same ACL.
72 # Test std permissions for rwx.
75 # Test out default ACLs and that the ACL is being PASSed
76 # onto the children of the dir.
79 # Test out access check for extended ACLs.
80 # -> 3 extra ACEs: MASK, GROUP, USER
81 # -> the GROUP compares with egid of process _and_ the supplementary
82 # groups (as found in /etc/group)
84 # Test that mask works for USER, GROUP, GROUP_OBJ
85 # Test that the ACE type priority is working
86 # -> this would be done by simultaneously matching on ACEs
87 # -> interesting if it allows user to specify ACEs in any order
90 acl1=1001;acl2=1002;acl3=1003
92 [ -x /bin/chacl ] || _notrun "chacl command not found"
93 [ -x $runas ] || _notrun "$runas executable not found"
101 #-------------------------------------------------------
102 # real QA test starts here
105 echo "=== Test minimal ACE ==="
111 echo "Test was executed"
116 chown $acl1.$acl2 file1
120 echo "--- Test get and set of ACL ---"
122 echo "Expect to FAIL"
123 chacl u::r--,g::rwx,o:rw- file1 2>&1
124 echo "Expect to PASS"
125 chacl u::r--,g::rwx,o::rw- file1 2>&1
129 echo "--- Test sync of ACL with std permissions ---"
136 echo "--- Test owner permissions ---"
137 chacl u::r-x,g::---,o::--- file1 2>&1
140 echo "Expect to PASS"
141 $runas -u $acl1 -g $acl1 ./file1 2>&1
142 echo "Expect to FAIL"
143 $runas -u $acl2 -g $acl2 ./file1 2>&1
146 echo "--- Test group permissions ---"
147 chacl u::---,g::r-x,o::--- file1 2>&1
149 echo "Expect to FAIL - acl1 is owner"
150 $runas -u $acl1 -g $acl1 ./file1 2>&1
151 echo "Expect to PASS - acl2 matches group"
152 $runas -u $acl2 -g $acl2 ./file1 2>&1
153 echo "Expect to PASS - acl2 matches sup group"
154 $runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
155 echo "Expect to FAIL - acl3 is not in group"
156 $runas -u $acl3 -g $acl3 ./file1 2>&1
159 echo "--- Test other permissions ---"
160 chacl u::---,g::---,o::r-x file1 2>&1
162 echo "Expect to FAIL - acl1 is owner"
163 $runas -u $acl1 -g $acl1 ./file1 2>&1
164 echo "Expect to FAIL - acl2 is in group"
165 $runas -u $acl2 -g $acl2 ./file1 2>&1
166 echo "Expect to FAIL - acl2 is in sup. group"
167 $runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
168 echo "Expect to PASS - acl3 is not owner or in group"
169 $runas -u $acl3 -g $acl3 ./file1 2>&1
171 #-------------------------------------------------------
174 echo "=== Test Extended ACLs ==="
177 echo "--- Test adding a USER ACE ---"
178 echo "Expect to FAIL as no MASK provided"
179 chacl u::---,g::---,o::---,u:$acl2:r-x file1 2>&1
180 echo "Ensure that ACL has not been changed"
182 echo "Expect to PASS - USER ACE matches user"
183 chacl u::---,g::---,o::---,u:$acl2:r-x,m::rwx file1 2>&1
185 $runas -u $acl2 -g $acl2 ./file1 2>&1
186 echo "Expect to FAIL - USER ACE does not match user"
187 $runas -u $acl3 -g $acl3 ./file1 2>&1
190 echo "--- Test adding a GROUP ACE ---"
191 echo "Expect to FAIL as no MASK provided"
192 chacl u::---,g::---,o::---,g:$acl2:r-x file1 2>&1
193 echo "Ensure that ACL has not been changed"
195 chacl u::---,g::---,o::---,g:$acl2:r-x,m::rwx file1 2>&1
197 echo "Expect to PASS - GROUP ACE matches group"
198 $runas -u $acl2 -g $acl2 ./file1 2>&1
199 echo "Expect to PASS - GROUP ACE matches sup group"
200 $runas -u $acl2 -g $acl1 -s $acl2 ./file1 2>&1
201 echo "Expect to FAIL - GROUP ACE does not match group"
202 $runas -u $acl3 -g $acl3 ./file1 2>&1
204 #-------------------------------------------------------
207 echo "--- Test MASK ---"
208 chacl u::---,g::---,o::---,g:$acl2:r-x,m::-wx file1 2>&1
210 echo "Expect to FAIL as MASK prohibits execution"
211 $runas -u $acl2 -g $acl2 ./file1 2>&1
212 chacl u::---,g::---,o::---,u:$acl2:r-x,m::-wx file1 2>&1
213 echo "Expect to FAIL as MASK prohibits execution"
214 $runas -u $acl2 -g $acl2 ./file1 2>&1
216 chacl u::---,g::---,o::---,u:$acl2:r-x,m::r-x file1 2>&1
217 echo "Expect to PASS as MASK allows execution"
218 $runas -u $acl2 -g $acl2 ./file1 2>&1
220 #-------------------------------------------------------
223 echo "--- Test ACE priority ---"
225 chacl o::rwx,g::rwx,u:$acl1:rwx,u::---,m::rwx file1 2>&1
226 echo "Expect to FAIL as should match on owner"
227 $runas -u $acl1 -g $acl2 ./file1 2>&1
229 chacl o::---,g::---,u:$acl2:rwx,u::---,m::rwx file1 2>&1
230 echo "Expect to PASS as should match on user"
231 $runas -u $acl2 -g $acl2 ./file1 2>&1
234 #-------------------------------------------------------
237 echo "=== Test can read ACLs without access permissions ==="
238 # This was a bug in kernel code where syscred wasn't being used
239 # to override the capabilities
240 chacl o::---,g::---,u::--- file1 2>&1
244 #-------------------------------------------------------
247 echo "=== Test Default ACLs ==="
249 chacl -b "u::rwx,g::rwx,o::rwx" "u::r-x,g::r--,o::---" ./acldir 2>&1
258 #-------------------------------------------------------