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_pos001
  35 #
  36 # DESCRIPTION:
  37 #       Verifies that ls displays @ in the file permissions using ls -@ 
  38 #       for files with attribute.
  39 #
  40 # STRATEGY:
  41 #       1. Create files with attribute files in directory A.
  42 #       2. Verify 'ls -l' can display @ in file permissions.
  43 #
  44 # TESTABILITY: explicit
  45 #
  46 # TEST_AUTOMATION_LEVEL: automated
  47 #
  48 # __stc_assertion_end
  49 #
  50 ################################################################################
  51 
  52 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
  53         && set -x
  54 
  55 echo "ASSERTION: Verifies that ls displays @ in the file permissions using ls -@ " \
  56         "for files with attribute."
  57 
  58 for user in root $ACL_STAFF1; do
  59         RUN_CHECK set_cur_usr $user || cleanup $STF_FAIL
  60 
  61         RUN_CHECK create_files $TESTDIR || cleanup $STF_FAIL
  62 
  63         initfiles=$($LS -R $INI_DIR/*)
  64         typeset -i i=0
  65         while (( i < NUM_FILE )); do
  66                 f=$(getitem $i $initfiles)
  67                 RUN_CHECK usr_exec $LS -@ $f | $AWK '{print substr($1, 11, 1)}' \
  68                         > $STF_TMPDIR/ls.$$ || cleanup $STF_FAIL $STF_TMPDIR/ls.$$
  69                 ls_attr=$(cat $STF_TMPDIR/ls.$$)
  70                 if [[ $ls_attr != "@" ]]; then
  71                         echo "ls -@ $f with attribute should success."
  72                         cleanup $STF_FAIL
  73                 else
  74                         # ls -@ $f with attribute success.
  75                         (( i += 1 ))
  76                 fi
  77         done
  78 
  79         cleanup
  80 done
  81 
  82 cleanup $STF_PASS