]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/acltools/tools-nfs4-trivial.test
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / acltools / tools-nfs4-trivial.test
1 # Copyright (c) 2011 Edward Tomasz NapieraƂa <trasz@FreeBSD.org>
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7 # 1. Redistributions of source code must retain the above copyright
8 #    notice, this list of conditions and the following disclaimer.
9 # 2. Redistributions in binary form must reproduce the above copyright
10 #    notice, this list of conditions and the following disclaimer in the
11 #    documentation and/or other materials provided with the distribution.
12 #
13 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 # SUCH DAMAGE.
24 #
25 # $FreeBSD$
26 #
27
28 # This is a tools-level test for acl_is_trivial_np(3).  Run it as root on ZFS.
29 # Note that this does not work on UFS with NFSv4 ACLs enabled - UFS recognizes
30 # both kind of trivial ACLs and replaces it by the default one.
31 #
32 # WARNING: Creates files in unsafe way.
33
34 $ whoami
35 > root
36 $ umask 022
37
38 # Check whether ls(1) correctly recognizes PSARC/2010/029-style trivial ACLs.
39 $ touch xxx
40
41 $ ls -l xxx | cut -d' ' -f1
42 > -rw-r--r--
43
44 $ getfacl -q xxx
45 >             owner@:rw-p--aARWcCos:------:allow
46 >             group@:r-----a-R-c--s:------:allow
47 >          everyone@:r-----a-R-c--s:------:allow
48
49 # Check whether ls(1) correctly recognizes draft-style trivial ACLs.
50 $ rm xxx
51 $ touch xxx
52 $ setfacl -a0 owner@:x:deny,owner@:rwpAWCo:allow,group@:wxp:deny,group@:r:allow,everyone@:wxpAWCo:deny,everyone@:raRcs:allow xxx
53 $ setfacl -x5 xxx
54 $ setfacl -x5 xxx
55 $ setfacl -x5 xxx
56
57 $ ls -l xxx | cut -d' ' -f1
58 > -rw-r--r--
59
60 $ getfacl -q xxx
61 >             owner@:--x-----------:------:deny
62 >             owner@:rw-p---A-W-Co-:------:allow
63 >             group@:-wxp----------:------:deny
64 >             group@:r-------------:------:allow
65 >          everyone@:-wxp---A-W-Co-:------:deny
66 >          everyone@:r-----a-R-c--s:------:allow
67
68 # Make sure ls(1) actually can recognize something as non-trivial.
69 $ setfacl -x0 xxx
70
71 $ ls -l xxx | cut -d' ' -f1
72 > -rw-r--r--+
73
74 $ getfacl -q xxx
75 >             owner@:rw-p---A-W-Co-:------:allow
76 >             group@:-wxp----------:------:deny
77 >             group@:r-------------:------:allow
78 >          everyone@:-wxp---A-W-Co-:------:deny
79 >          everyone@:r-----a-R-c--s:------:allow
80
81 $ rm xxx
82