17b1753e6SJohn Wren Kennedy#!/usr/bin/ksh -p 27b1753e6SJohn Wren Kennedy# 37b1753e6SJohn Wren Kennedy# CDDL HEADER START 47b1753e6SJohn Wren Kennedy# 57b1753e6SJohn Wren Kennedy# The contents of this file are subject to the terms of the 67b1753e6SJohn Wren Kennedy# Common Development and Distribution License (the "License"). 77b1753e6SJohn Wren Kennedy# You may not use this file except in compliance with the License. 87b1753e6SJohn Wren Kennedy# 97b1753e6SJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107b1753e6SJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 117b1753e6SJohn Wren Kennedy# See the License for the specific language governing permissions 127b1753e6SJohn Wren Kennedy# and limitations under the License. 137b1753e6SJohn Wren Kennedy# 147b1753e6SJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 157b1753e6SJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167b1753e6SJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 177b1753e6SJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 187b1753e6SJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 197b1753e6SJohn Wren Kennedy# 207b1753e6SJohn Wren Kennedy# CDDL HEADER END 217b1753e6SJohn Wren Kennedy# 227b1753e6SJohn Wren Kennedy 237b1753e6SJohn Wren Kennedy# 247b1753e6SJohn Wren Kennedy# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 257b1753e6SJohn Wren Kennedy# Use is subject to license terms. 267b1753e6SJohn Wren Kennedy# 277b1753e6SJohn Wren Kennedy 287b1753e6SJohn Wren Kennedy# 29*1d32ba66SJohn Wren Kennedy# Copyright (c) 2013, 2016 by Delphix. All rights reserved. 307b1753e6SJohn Wren Kennedy# Copyright (c) 2013 by Paul B. Henson <henson@acm.org>. 317b1753e6SJohn Wren Kennedy# All rights reserved. 327b1753e6SJohn Wren Kennedy# 337b1753e6SJohn Wren Kennedy 347b1753e6SJohn Wren Kennedy 357b1753e6SJohn Wren Kennedy. $STF_SUITE/tests/functional/acl/acl.cfg 367b1753e6SJohn Wren Kennedy. $STF_SUITE/tests/functional/acl/acl_common.kshlib 377b1753e6SJohn Wren Kennedy 387b1753e6SJohn Wren Kennedy# 397b1753e6SJohn Wren Kennedy# DESCRIPTION: 407b1753e6SJohn Wren Kennedy# Verify mode bits based chmod fails on files/directories with 417b1753e6SJohn Wren Kennedy# non-trivial ACLs when aclmode=restricted 427b1753e6SJohn Wren Kennedy# 437b1753e6SJohn Wren Kennedy# STRATEGY: 447b1753e6SJohn Wren Kennedy# 1. Loop super user and non-super user to run the test case 457b1753e6SJohn Wren Kennedy# 2. Create test file and directory 467b1753e6SJohn Wren Kennedy# 3. Set non-trivial ACL on test file and directory 477b1753e6SJohn Wren Kennedy# 4. Verify mode bits based chmod fails 487b1753e6SJohn Wren Kennedy# 497b1753e6SJohn Wren Kennedy 507b1753e6SJohn Wren Kennedyverify_runnable "both" 517b1753e6SJohn Wren Kennedy 527b1753e6SJohn Wren Kennedyfunction cleanup 537b1753e6SJohn Wren Kennedy{ 547b1753e6SJohn Wren Kennedy # reset aclmode=discard 55*1d32ba66SJohn Wren Kennedy log_must zfs set aclmode=discard $TESTPOOL/$TESTFS 567b1753e6SJohn Wren Kennedy} 577b1753e6SJohn Wren Kennedy 587b1753e6SJohn Wren Kennedylog_assert "Verify mode bits based chmod fails on files/directories "\ 597b1753e6SJohn Wren Kennedy "with non-trivial ACLs when aclmode=restricted" 607b1753e6SJohn Wren Kennedylog_onexit cleanup 617b1753e6SJohn Wren Kennedy 62*1d32ba66SJohn Wren Kennedylog_must zfs set aclmode=restricted $TESTPOOL/$TESTFS 637b1753e6SJohn Wren Kennedy 647b1753e6SJohn Wren Kennedyfor user in root $ZFS_ACL_STAFF1; do 657b1753e6SJohn Wren Kennedy log_must set_cur_usr $user 667b1753e6SJohn Wren Kennedy 67*1d32ba66SJohn Wren Kennedy log_must usr_exec mkdir $TESTDIR/testdir 68*1d32ba66SJohn Wren Kennedy log_must usr_exec touch $TESTDIR/testfile 697b1753e6SJohn Wren Kennedy 707b1753e6SJohn Wren Kennedy # Make sure ACL is non-trival 71*1d32ba66SJohn Wren Kennedy log_must usr_exec chmod A+user:${ZFS_ACL_STAFF1}:r::allow \ 727b1753e6SJohn Wren Kennedy $TESTDIR/testdir $TESTDIR/testfile 737b1753e6SJohn Wren Kennedy 74*1d32ba66SJohn Wren Kennedy log_mustnot usr_exec chmod u-w $TESTDIR/testdir 75*1d32ba66SJohn Wren Kennedy log_mustnot usr_exec chmod u-w $TESTDIR/testfile 767b1753e6SJohn Wren Kennedy 77*1d32ba66SJohn Wren Kennedy log_must usr_exec rmdir $TESTDIR/testdir 78*1d32ba66SJohn Wren Kennedy log_must usr_exec rm $TESTDIR/testfile 797b1753e6SJohn Wren Kennedydone 807b1753e6SJohn Wren Kennedy 817b1753e6SJohn Wren Kennedylog_pass "Verify mode bits based chmod fails on files/directories "\ 827b1753e6SJohn Wren Kennedy "with non-trivial ACLs when aclmode=restricted passed." 83