cifs_attr_003_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.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify the DOS attributes (Readonly, Hidden, Archive, System)
# and BSD'ish attributes (Immutable, nounlink, and appendonly)
# will provide the proper access limitation as expected.
#
# Readonly means that the content of a file can't be modified, but
# timestamps, mode and so on can.
#
# Archive - Indicates if a file should be included in the next backup
# of the file system. ZFS will set this bit whenever a file is
# modified.
#
# Hidden and System (ZFS does nothing special with these, other than
# letting a user/application set them.
#
# Immutable (The data can't, change nor can mode, ACL, size and so on)
# The only attribute that can be updated is the access time.
#
# removed.
# This will also effect a rename operation, since that involes a
# remove.
#
# Appendonly - File can only be appended to.
#
# nodump, settable, opaque (These are for the MacOS port) we will
# allow them to be set, but have no semantics tied to them.
#
# STRATEGY:
# 1. Loop super user and non-super user to run the test case.
# 2. Create basedir and a set of subdirectores and files within it.
# 4. Verify the access limitation works as expected.
#
verify_runnable "both"
function cleanup
{
if [[ -n $gobject ]]; then
fi
done
}
#
# Set the special attribute to the given node
#
# $2: The special attribute to be set
#
function set_attribute
{
typeset object=$1
typeset attr=$2
if [[ -z $attr ]]; then
attr="AHRSadimu"
if [[ -f $object ]]; then
attr="${attr}q"
fi
fi
return $?
}
#
# Clear the special attribute to the given node
#
# $2: The special attribute to be cleared
#
function clear_attribute
{
typeset object=$1
typeset attr=$2
if [[ -z $attr ]]; then
if is_global_zone ; then
attr="AHRSadimu"
if [[ -f $object ]]; then
attr="${attr}q"
fi
else
attr="AHRS"
fi
fi
return $?
}
#
# A wrapper function to call test function according to the given attr
#
# $2: The special attribute to be test
#
function test_wrapper
{
typeset object=$1
typeset attr=$2
fi
;;
;;
;;
;;
esac
if [[ -n $func ]]; then
fi
}
#
# Invoke the function and verify whether its return code as expected
#
# $1: Expect value
# $2-$n: Function and args need to be invoked
#
function verify_expect
{
typeset -i expect=$1
typeset status
shift
status=$?
log_fail "$@ unexpect return 0"
fi
else
fi
fi
}
#
# Unit testing function against overwrite file
#
# $1: The given file node
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_writefile
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
if [[ -f $object ]]; then
fi
}
#
# Unit testing function against write new stuffs into a directory
#
# $1: The given directory node
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_writedir
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
if [[ -d $object ]]; then
fi
}
function unit_appenddata
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
if [[ ! -d $object ]]; then
fi
}
#
# Unit testing function against delete content from a directory
#
# $1: The given node, dir
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_deletecontent
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
if [[ -d $object ]]; then
if [[ -e $target ]]; then
fi
done
fi
}
#
# Unit testing function against delete a node
#
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_deletedata
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
}
#
# Unit testing function against write xattr to a node
#
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_writexattr
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
fi
}
#
# Unit testing function against modify accesstime of a node
#
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_accesstime
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
if [[ -d $object ]]; then
else
fi
}
#
# Unit testing function against modify updatetime of a node
#
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_updatetime
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
typeset immutable_expect=${4:-$expect}
}
#
# Unit testing function against write acl of a node
#
# $2: Execute user
# $3: Expect value, default to be zero
#
function unit_writeacl
{
typeset object=$1
typeset user=$2
typeset expect=${3:-0}
}
#
# Testing function to verify the given node is readonly
#
#
function test_readonly
{
typeset object=$1
if [[ -z $object ]]; then
fi
for user in $ZFS_ACL_CUR_USER root $ZFS_ACL_STAFF2; do
if [[ -d $object ]]; then
else
fi
if [[ -d $object ]]; then
else
fi
if [[ -d $object ]] ;then
else
fi
done
}
#
# Testing function to verify the given node is immutable
#
#
function test_immutable
{
typeset object=$1
if [[ -z $object ]]; then
fi
for user in $ZFS_ACL_CUR_USER root $ZFS_ACL_STAFF2; do
if [[ -d $object ]]; then
else
fi
if [[ -d $object ]] ;then
else
fi
done
}
#
# Testing function to verify the given node is nounlink
#
#
function test_nounlink
{
typeset object=$1
if [[ -z $object ]]; then
fi
for user in $ZFS_ACL_CUR_USER root $ZFS_ACL_STAFF2; do
if [[ -d $object ]]; then
else
fi
if [[ -d $object ]] ;then
else
fi
done
}
#
# Testing function to verify the given node is appendonly
#
#
function test_appendonly
{
typeset object=$1
if [[ -z $object ]]; then
fi
for user in $ZFS_ACL_CUR_USER root $ZFS_ACL_STAFF2; do
if [[ -d $object ]]; then
else
fi
if [[ -d $object ]] ;then
else
fi
done
}
FILES="file.0 file.1"
DIRS="dir.0 dir.1"
XATTRS="attr.0 attr.1"
if is_global_zone ; then
ATTRS="R i u a"
else
ATTRS="R"
fi
TESTMODE=777
TESTSTR="ZFS test suites"
ace_dir="add_file/add_subdirectory/${ace_file}"
log_assert "Verify DOS & BSD'ish attributes will provide the " \
"access limitation as expected."
typeset gobject
typeset gattr
done
done
done
done
done
log_pass "DOS & BSD'ish attributes provide the access limitation as expected."