1 #! /usr/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 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 . $STF_SUITE/tests/acl/acl_common.kshlib
29
30 #################################################################################
31 #
32 # __stc_assertion_start
33 #
34 # ID: acl_ls_neg001
35 #
36 # DESCRIPTION:
37 # Verifies that ls doesn't display @ in the file permissions using ls -@
38 # for files without attribute.
39 #
40 # STRATEGY:
41 # 1. Create files with attribute files in directory A.
42 # 2. Removed all attribute files.
43 # 3. Verify 'ls -l' can't display @ in file permission.
44 #
45 # TESTABILITY: explicit
46 #
47 # TEST_AUTOMATION_LEVEL: automated
48 #
49 # __stc_assertion_end
50 #
51 ################################################################################
52
53 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
54 && set -x
55
56 echo "ASSERTION: Verifies that ls doesn't display @ in the file " \
57 "permissions using ls -@ for files without attribute."
58
59 for user in root $ACL_STAFF1; do
60 RUN_CHECK set_cur_usr $user || cleanup $STF_FAIL
61
62 RUN_CHECK create_files $TESTDIR || cleanup $STF_FAIL
63
64 initfiles=$($LS -R $INI_DIR/*)
65 typeset -i i=0
66 while (( i < NUM_FILE )); do
67 f=$(getitem $i $initfiles)
68 RUN_CHECK usr_exec $RUNAT $f $RM attribute* || cleanup $STF_FAIL
69 RUN_CHECK usr_exec $LS -l $f | $AWK '{print substr($1, 11, 1)}' \
70 > $STF_TMPDIR/ls.$$ || cleanup $STF_FAIL $STF_TMPDIR/ls.$$
71 ls_attr=$(cat $STF_TMPDIR/ls.$$)
72 if [[ $ls_attr == "@" ]]; then
73 echo "ls with attribute shouldn't success."
74 cleanup $STF_FAIL
75 fi
76
77 (( i += 1 ))
78 done
79
80 cleanup
81 done
82
83 cleanup $STF_PASS