#!/usr/bin/perl -w

# This is a special restricted shell that has two modes
#
# - By default a user can only execute "rssh" (which restricts users to 
#   sftp and other copy operations)
#
# - If a user has started a session (noted in /var/lib/nitrcce/sessions/username.lck
#   then they are allowed to execute bash

use POSIX;

$cmd = "/usr/bin/rssh";
$user = getpwuid($<);
if (-e ("/var/lib/nitrcce/sessions/".$user.".lck")){
    $cmd = "/bin/bash";
}
exec $cmd, @ARGV;
