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_cp_neg001
  35 #
  36 # DESCRIPTION:
  37 #       Verifies that cp will not include file attribute when the -@ flag is not
  38 #       present.
  39 #
  40 # STRATEGY:
  41 #       1. In directory A, create several files and add attribute files for them
  42 #       2. Implement cp to files without '-@'
  43 #       3. Verify attribute files will not include file attribute
  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 cp will not include file attribute when the -@ flag "\
  57         "is not present."
  58 
  59 for user in root $ACL_STAFF1; do
  60 
  61         RUN_CHECK set_cur_usr $user || cleanup $STF_FAIL
  62 
  63         RUN_CHECK create_files $TESTDIR || cleanup $STF_FAIL
  64 
  65         initfiles=$($LS -R $INI_DIR/*)
  66         typeset -i i=0
  67         while (( i < NUM_FILE )); do
  68                 typeset f=$(getitem $i $initfiles)
  69                 RUN_CHECK usr_exec $CP $f $TST_DIR || cleanup $STF_FAIL
  70 
  71                 testfiles=$($LS -R $TST_DIR/*)
  72                 tf=$(getitem $i $testfiles)
  73                 ls_attr=$($LS -@ $tf | $AWK '{print substr($1, 11, 1)}')
  74                 if [[ $ls_attr == "@" ]]; then
  75                         echo "cp of attribute should fail without " \
  76                                 "-@ or -p option"
  77                         cleanup $STF_FAIL
  78                 fi
  79 
  80                 (( i += 1 ))
  81         done
  82 
  83         cleanup
  84 done
  85 
  86 cleanup $STF_PASS