]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh
Add the ZFS Test Suite
[mirror_zfs.git] / tests / zfs-tests / tests / functional / acl / posix / posix_002_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 . $STF_SUITE/include/libtest.shlib
29
30 #
31 # Copyright (c) 2012 by Delphix. All rights reserved.
32 #
33
34 #
35 # DESCRIPTION:
36 # Verify that user can access file/directory if acltype=posixacl.
37 #
38 # STRATEGY:
39 # 1. Test access to directory (mode=-wx)
40 # a. Can create file in dir
41 # b. Can't list directory
42 #
43
44 verify_runnable "both"
45 log_assert "Verify acltype=posixacl works on directory"
46
47 # Test access to DIRECTORY
48 log_note "Testing access to DIRECTORY"
49 log_must $MKDIR $TESTDIR/dir.0
50 log_must $SETFACL -m g:zfsgrp:wx $TESTDIR/dir.0
51 $GETFACL $TESTDIR/dir.0 2> /dev/null | $EGREP -q "^group:zfsgrp:-wx$"
52 if [ "$?" -eq "0" ]; then
53 # Should be able to create file in directory
54 log_must $SU staff1 -c "$TOUCH $TESTDIR/dir.0/file.0"
55
56 # Should NOT be able to list files in directory
57 log_mustnot $SU staff1 -c "$LS -l $TESTDIR/dir.0"
58
59 log_pass "POSIX ACL mode works on directories"
60 else
61 log_fail "Group 'zfsgrp' does not have 'rwx' as specified"
62 fi