3 # "Shell" for a restricted account, limiting the available commands
4 # Roland Mas, debian-sf (Sourceforge for Debian)
6 # Inspired from the grap.c file in Sourceforge 2.5
9 use vars qw/ @allowed_options @allowed_commands $errmsg @cmd / ;
10 use subs qw/ &reject / ;
13 @allowed_options = ('-c', '-e') ;
14 @allowed_commands = ('cvs','scp','svnserve') ;
16 # Clean up our environment
17 delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)};
21 $errmsg = "Not enough arguments." ;
23 $errmsg = "Too many arguments." ;
28 if (scalar (grep { $_ eq $ARGV[0] } @allowed_options) == 0) {
29 $errmsg = "Option not allowed." ;
33 @cmd = split (/ +/, $ARGV[1]) ;
35 if (scalar (grep { $_ eq $cmd[0] } @allowed_commands) == 0) {
36 $errmsg = "Command not allowed." ;
43 print "This is a restricted account.\n" .
44 "You cannot execute anything here.\n" .