mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
move some acl funcs into common.attr
This commit is contained in:
@@ -85,8 +85,7 @@ rm -f $seq.full
|
||||
|
||||
_need_to_be_root
|
||||
_acl_setup_ids
|
||||
|
||||
[ ! -x /bin/chacl -a ! -x /usr/bin/chacl ] && _notrun "chacl command not found"
|
||||
_acl_requirements
|
||||
[ -x $runas ] || _notrun "$runas executable not found"
|
||||
|
||||
# get dir
|
||||
@@ -95,15 +94,6 @@ rm -rf $seq.dir1
|
||||
mkdir $seq.dir1
|
||||
cd $seq.dir1
|
||||
|
||||
# test if acl_get syscall is operational
|
||||
# and hence the ACL config has been turned on
|
||||
touch syscalltest
|
||||
if chacl -l syscalltest 2>&1 | tee -a $here/$seq.full | grep 'Function not implemented' >/dev/null
|
||||
then
|
||||
cd $here
|
||||
_notrun "requires kernel ACL support"
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------
|
||||
# real QA test starts here
|
||||
echo "QA output created by $seq"
|
||||
@@ -353,38 +343,12 @@ XFS_ACL_MAX_ENTRIES=25
|
||||
num_aces_pre=`expr $XFS_ACL_MAX_ENTRIES - 1`
|
||||
num_aces_post=`expr $XFS_ACL_MAX_ENTRIES + 1`
|
||||
|
||||
_create_n_aces()
|
||||
{
|
||||
n=`expr $1 - 4`
|
||||
acl='u::rwx,g::rwx,o::rwx,m::rwx' # 4 ace acl start
|
||||
while [ $n -ne 0 ]; do
|
||||
acl="$acl,u:$n:rwx"
|
||||
n=`expr $n - 1`
|
||||
done
|
||||
echo $acl
|
||||
}
|
||||
|
||||
_filter_aces()
|
||||
{
|
||||
$AWK_PROG '
|
||||
BEGIN {
|
||||
FS=":"
|
||||
while ( getline <"/etc/passwd" > 0 ) {
|
||||
idlist[$1] = $3
|
||||
}
|
||||
}
|
||||
/^user/ { if ($2 in idlist) sub($2, idlist[$2])}
|
||||
{print}
|
||||
'
|
||||
}
|
||||
|
||||
acl1=`_create_n_aces $num_aces_pre`
|
||||
acl2=`_create_n_aces $XFS_ACL_MAX_ENTRIES`
|
||||
acl3=`_create_n_aces $num_aces_post`
|
||||
acl4=`_create_n_aces 16` # Andreas G. libacl size for initial get
|
||||
acl5=`_create_n_aces 17` # 1 over A.G. libacl initial size
|
||||
|
||||
|
||||
echo "1 below xfs acl max"
|
||||
chacl $acl1 largeaclfile
|
||||
getfacl largeaclfile | _filter_aces
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
#! /bin/sh
|
||||
# XFS QA Test No. 067
|
||||
# $Id: 067,v 1.1 2002/05/09 05:26:20 tes Exp $
|
||||
#
|
||||
# Test out acl/dacls which fit in shortform in the inode
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Further, this software is distributed without any warranty that it is
|
||||
# free of the rightful claim of any third person regarding infringement
|
||||
# or the like. Any license provided herein, whether implied or
|
||||
# otherwise, applies only to this software file. Patent licenses, if
|
||||
# any, provided herein do not apply to combinations of this program with
|
||||
# other software, or any other product whatsoever.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write the Free Software Foundation, Inc., 59
|
||||
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
#
|
||||
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
|
||||
# Mountain View, CA 94043, or:
|
||||
#
|
||||
# http://www.sgi.com
|
||||
#
|
||||
# For further information regarding this notice, see:
|
||||
#
|
||||
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=tes@sagan.melbourne.sgi.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.attr
|
||||
|
||||
# real QA test starts here
|
||||
|
||||
_notrun "Causes panic - need to investigate"
|
||||
|
||||
_need_to_be_root
|
||||
_acl_requirements
|
||||
_require_scratch
|
||||
|
||||
# set up fs for 1K inodes
|
||||
export MKFS_OPTIONS="-i size=1024"
|
||||
mkfs_xfs $SCRATCH_DEV>>$here/$seq.full ||\
|
||||
_error "mkfs failed"
|
||||
mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$here/$seq.full ||\
|
||||
_error "mount failed"
|
||||
cd $SCRATCH_MNT
|
||||
|
||||
# xfs_growfs -n $SCRATCH_MNT
|
||||
|
||||
echo ""
|
||||
echo "=== Test out large ACLs ==="
|
||||
|
||||
mkdir largeacldir
|
||||
|
||||
# John Trostel reported probs with going from 20 to 21 aces
|
||||
# 20 ace ACL = 20*12+4 = 244 bytes
|
||||
# 21 ace ACL = 21*12+4 = 256 bytes - too big for shortform
|
||||
# the 21 ace ACL can not be shortform
|
||||
#
|
||||
acl20=`_create_n_aces 20`
|
||||
acl21=`_create_n_aces 21`
|
||||
|
||||
echo "try 20 aces for access acl"
|
||||
chacl $acl20 largeacldir
|
||||
getfacl largeacldir | _filter_aces
|
||||
|
||||
echo "try 20 aces for default acl"
|
||||
chacl -d $acl20 largeacldir
|
||||
getfacl largeacldir | _filter_aces
|
||||
|
||||
echo "try 21 aces for access acl"
|
||||
chacl $acl21 largeacldir
|
||||
getfacl largeacldir | _filter_aces
|
||||
|
||||
echo "try 21 aces for default acl"
|
||||
chacl -d $acl21 largeacldir
|
||||
getfacl largeacldir | _filter_aces
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
+49
@@ -74,5 +74,54 @@ _acl_ls()
|
||||
ls -ln $* | awk '{ print $1, $3, $4, $NF }' | _acl_filter_id
|
||||
}
|
||||
|
||||
# create an ACL with n ACEs in it
|
||||
#
|
||||
_create_n_aces()
|
||||
{
|
||||
n=`expr $1 - 4`
|
||||
acl='u::rwx,g::rwx,o::rwx,m::rwx' # 4 ace acl start
|
||||
while [ $n -ne 0 ]; do
|
||||
acl="$acl,u:$n:rwx"
|
||||
n=`expr $n - 1`
|
||||
done
|
||||
echo $acl
|
||||
}
|
||||
|
||||
# filter user ace names to user ids
|
||||
#
|
||||
_filter_aces()
|
||||
{
|
||||
$AWK_PROG '
|
||||
BEGIN {
|
||||
FS=":"
|
||||
while ( getline <"/etc/passwd" > 0 ) {
|
||||
idlist[$1] = $3
|
||||
}
|
||||
}
|
||||
/^user/ { if ($2 in idlist) sub($2, idlist[$2])}
|
||||
{print}
|
||||
'
|
||||
}
|
||||
|
||||
# test if acl code will work
|
||||
#
|
||||
_acl_requirements()
|
||||
{
|
||||
xfsdir=$TEST_DIR
|
||||
|
||||
if [ ! -x /bin/chacl -a ! -x /usr/bin/chacl ]; then
|
||||
_notrun "chacl command not found"
|
||||
fi
|
||||
|
||||
# test if acl_get syscall is operational
|
||||
# and hence the ACL config has been turned on
|
||||
touch $xfsdir/syscalltest
|
||||
if chacl -l $xfsdir/syscalltest 2>&1 | tee -a $here/$seq.full | grep 'Function not implemented' >/dev/null
|
||||
then
|
||||
cd $here
|
||||
_notrun "requires kernel ACL support"
|
||||
fi
|
||||
}
|
||||
|
||||
# make sure this script returns success
|
||||
/bin/true
|
||||
|
||||
Reference in New Issue
Block a user