4 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like. Any license provided herein, whether implied or
17 # otherwise, applies only to this software file. Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA 94043, or:
30 # For further information regarding this notice, see:
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 # common extended attribute and ACL support
37 # pick three unused user/group ids, store them as $acl[1-3]
41 eval `cat /etc/passwd /etc/group | awk -F: '
45 for(i=1; i<1000000 && j<=3;i++){
47 printf "acl%d=%d;", j, i;
54 # filter for the acl ids selected above
59 -e "s/u:$acl1/u:id1/" \
60 -e "s/u:$acl2/u:id2/" \
61 -e "s/u:$acl3/u:id3/" \
62 -e "s/g:$acl1/g:id1/" \
63 -e "s/g:$acl2/g:id2/" \
64 -e "s/g:$acl3/g:id3/" \
65 -e "s/ $acl1 / id1 /" \
66 -e "s/ $acl2 / id2 /" \
74 ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
77 # create an ACL with n ACEs in it
82 acl='u::rwx,g::rwx,o::rwx,m::rwx' # 4 ace acl start
83 while [ $n -ne 0 ]; do
90 # filter user ace names to user ids
97 while ( getline <"/etc/passwd" > 0 ) {
101 /^user/ { if ($2 in idlist) sub($2, idlist[$2])}
106 # test if acl code will work
112 if [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ]; then
113 _notrun "chacl command not found"
116 # test if acl_get syscall is operational
117 # and hence the ACL config has been turned on
118 touch $xfsdir/syscalltest
119 if chacl -l $xfsdir/syscalltest 2>&1 | tee -a $here/$seq.full | grep 'Function not implemented' >/dev/null
122 _notrun "requires kernel ACL support"
126 # make sure this script returns success