#!/bin/sh

# $Id: shell,v 3.0.1.1 1995/01/03 18:21:41 ram Exp $
#
#  Copyright (c) 1990-1993, Raphael Manfredi
#  
#  You may redistribute only under the terms of the Artistic License,
#  as specified in the README file that comes with the distribution.
#  You may reuse parts of this distribution only within the terms of
#  that same Artistic License; a copy of which may be found at the root
#  of the source tree for mailagent 3.0.
#
# $Log: shell,v $
# Revision 3.0.1.1  1995/01/03  18:21:41  ram
# patch24: power checking was not correctly performed (was too restrictive)
#
# Revision 3.0  1993/11/29  13:50:32  ram
# Baseline for mailagent 3.0 netwide release.
#
# 

# Execute commands from stdin, as transmitted by the mailagent server.
# File descriptor #3 is a channel to the session transcript.

# Make sure we have the shell power.
# Don't even allow the root power to bypass that for security reasons.
case ":$powers:" in
*:shell:*) ;;
*)
	echo "Permission denied." >&3
	exit 1
	;;
esac

# Perhaps a shell was defined... Otherwise, use /bin/sh
case "$shell" in
'') shell='/bin/sh';;
esac

# Normally, a shell command has its output included in the transcript only in
# case of error or when the user requests the trace. Here however, we need to
# see what happened, so everything is redirected to the session transcript.

exec $shell -x >&3 2>&3
