########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# David Korn <dgk@research.att.com> #
# #
########################################################################
function err_exit
{
print -u2 -n "\t"
let Errors+=1
}
alias err_exit='err_exit $LINENO'
integer Errors=0
# test restricted shell
pwd=$PWD
/*) ;;
esac
function check_restricted
{
grep restricted out > /dev/null 2>&1
}
> empty
print 'echo hello' > script
print 'echo hello> file' > script
! check_restricted script || err_exit 'script with output redirection should run in restricted mode'
print 'PATH=/bin' > script
#! $SHELL
print hello
!
! check_restricted 'script' || err_exit 'script with #! pathname should run in restricted mode even if last command in script'
do check_restricted "function foo { typeset $i=foobar;};foo" || err_exit "$i can be changed in function by using typeset"
done