1 #
   2 # Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #
  23 
  24 #
  25 
  26 # set platform-dependent variable
  27 OS=`uname -s`
  28 case "$OS" in
  29   Linux | Darwin ) TMP=/tmp ;;
  30   Windows_98 )    return    ;;
  31   CYGWIN_* )      TMP="c:/temp" ;;
  32   Windows* )      SID=`sid`; TMP="c:/temp"  ;;
  33   * )
  34     echo "Unrecognized system! ${OS}"
  35     exit 1
  36     ;;
  37 esac
  38 
  39 TMP1=${TMP}/tmp1_$$
  40 FAIL=0;
  41 
  42 deny() {
  43   case "$OS" in
  44   Windows* ) chacl -d ${SID}:f $* ;;
  45   * )        chmod 000 $*         ;;
  46   esac
  47 }
  48 
  49 allow() {
  50   case "$OS" in
  51   Windows* ) chacl -g ${SID}:f $* ;;
  52   * )        chmod 777 $*         ;;
  53   esac
  54 }
  55 
  56 runTest() {
  57   ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} GetXSpace $*
  58   if [ $? -eq 0 ]
  59   then echo "Passed"
  60   else
  61     echo "FAILED"
  62     FAIL=`expr ${FAIL} + 1`
  63   fi
  64 }
  65 
  66 # df output
  67 runTest
  68 
  69 # readable file in an unreadable directory
  70 mkdir -p ${TMP1}
  71 touch ${TMP1}/foo
  72 deny ${TMP1}
  73 runTest ${TMP1}/foo
  74 allow ${TMP1}
  75 rm -rf ${TMP1}
  76 
  77 if [ ${FAIL} -ne 0 ]
  78 then
  79   echo ""
  80   echo "${FAIL} test(s) failed"
  81   exit 1
  82 fi