cifs_attr_001_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
#
# 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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify the user with write_attributes permission or
# (Readonly, Hidden, Archive, System)
#
# 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.
# 3. Grant user has write_attributes permission or
# PRIV_FILE_OWNER privilege
#
verify_runnable "both"
function cleanup
{
done
}
#
# Set the special attribute to the given node
#
# $2: The special attribute to be set
# $3: Execute username
#
function set_attribute
{
typeset object=$1
typeset user=$3
typeset ret=0
if [[ -z $object ]]; then
log_fail "Object not defined."
fi
if [[ -n $user ]]; then
ret=$?
else
ret=$?
fi
return $ret
}
#
# Clear the special attribute to the given node
#
# $2: The special attribute to be cleared
# $3: Execute username
#
function clear_attribute
{
typeset object=$1
typeset user=$3
typeset ret=0
if [[ -z $object ]]; then
log_fail "Object not defined."
fi
if [[ -n $user ]]; then
ret=$?
else
ret=$?
fi
return $ret
}
#
# Grant the ace of write_attributes to the given user
#
# $1: The given user
#
function grant_attr
{
typeset user=$1
typeset object=$2
fi
# To increase the coverage, here we set 'deny' against
# superuser and owner.
# Only grant the user explicitly while it's not root neither owner.
else
fi
else
fi
attr_mod="write_attributes"
}
#
# Revoke the ace of write_attributes from the given user
#
# $1: The given user
#
function revoke_attr
{
typeset user=$1
typeset object=$2
fi
}
#
# Invoke the function and verify whether its return code as expected
#
# $1: Function be invoked
# $3: Execute user
# $4: Option
#
function verify_attr
{
typeset func=$1
typeset object=$2
typeset opt=$3
typeset user=$4
typeset expect="log_mustnot"
Opt($opt) not defined."
fi
# If user is superuser or has write_attributes permission or
# PRIV_FILE_OWNER privilege, it should log_must,
# otherwise log_mustnot.
expect="log_must"
fi
}
log_assert "Verify set/clear DOS attributes will succeed while user has " \
"write_attributes permission or PRIV_FILE_OWNER privilege"
file="file.0"
dir="dir.0"
XATTROPTIONS="H S R A"
done
done
done
done
done
done
"write_attributes permission or PRIV_FILE_OWNER privilege"