zfs_acl_chmod_delete_001_pos.ksh revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# DESCRIPTION:
# Verify that the combined delete_child/delete permission for
#
# -------------------------------------------------------
# | Parent Dir | Target Object Permissions |
# | permissions | |
# -------------------------------------------------------
# | | ACL Allows | ACL Denies| Delete |
# | | Delete | Delete | unspecified|
# -------------------------------------------------------
# | ACL Allows | Permit | Permit | Permit |
# | DELETE_CHILD | |
# -------------------------------------------------------
# | ACL Denies | Permit | Deny | Deny |
# | DELETE_CHILD | | | |
# -------------------------------------------------------
# | ACL specifies | | | |
# | only allows | Permit | Permit | Permit |
# | write and | | | |
# | execute | | | |
# -------------------------------------------------------
# | ACL denies | | | |
# | write and | Permit | Deny | Deny |
# | execute | | | |
# -------------------------------------------------------
#
# STRATEGY:
# 1. Create file and directory in zfs filesystem
# 2. Set special ACE combination to the file and directory
# 3. Try to remove the file
#
verify_runnable "both"
function cleanup
{
if [[ ! -e $target ]]; then
fi
(( ${#cwd} != 0 )) && cd $cwd
if [[ -e $TESTDIR/$ARCHIVEFILE ]]; then
fi
return 0
}
#owner@ group group_users other_users
set -A users \
"root" "root" "$ZFS_ACL_ADMIN" "$ZFS_ACL_OTHER1" \
set -A access_parent \
"delete_child:allow" \
"delete_child:deny" \
"write_data:allow" \
"write_data:deny" \
"delete_child:deny write_data:allow" \
"delete_child:allow write_data:deny"
set -A access_target \
"delete:allow" \
"delete:deny" \
""
set -A a_flag "owner@" "group@" "everyone@" "user:$ZFS_ACL_STAFF1"
function operate_node #user node
{
typeset user=$1
typeset node=$2
typeset ret
log_fail "user, node are not defined."
fi
if [[ -d $node ]]; then
else
chgusr_exec $user $RM -f $node ; ret=$?
fi
if [[ -e $node ]]; then
return 1
fi
else
return 1
fi
fi
return $ret
}
function logname #acl_parent acl_target user
{
typeset acl_parent=$1
typeset acl_target=$2
typeset user=$3
# To super user, read and write deny permission was override.
if [[ $user == root || $acl_target == *:allow ]]; then
print "log_must"
print "log_must"
else
print "log_mustnot"
fi
print "log_must"
else
print "log_mustnot"
fi
else
print "log_mustnot"
fi
}
function check_chmod_results #node flag acl_parent acl_target g_usr o_usr
{
typeset node=$1
typeset flag=$2
typeset acl_parent=$3
typeset acl_target=$2:$4
typeset g_usr=$5
typeset o_usr=$6
for acl in $acl_parent ; do
done
fi
fi
fi
fi
}
function test_chmod_basic_access #node g_usr o_usr
{
typeset node=${1%/}
typeset g_usr=$2
typeset o_usr=$3
typeset -i i=0
i=0
(( i = i + 1))
done
[[ -n $acl_t ]] && \
[[ -n $acl_t ]] && \
done
while (( i > 0 )); do
(( i = i - 1 ))
done
done
done
}
function setup_test_files #base_node user group
{
typeset base_node=$1
typeset user=$2
typeset group=$3
return 0
}
function cleanup_test_files #base_node
{
typeset base_node=$1
if [[ -d $base_node ]]; then
elif [[ -e $base_node ]]; then
fi
return 0
}
typeset ARCHIVEFILE=archive.tar
typeset -i i=0
typeset -i j=0
typeset target
cd $TESTDIR
while (( i < ${#users[@]} )); do
j=0
while (( j < 1 )); do
"${users[((i+2))]}" "${users[((i+3))]}"
"${users[((i+2))]}" "${users[((i+3))]}"
(( j = j + 1 ))
done
(( i += 4 ))
done