[X2go-dev] x2gosessionlimit and user limits

John A. Sullivan III jsullivan at opensourcedevel.com
Sun Mar 14 01:37:14 CET 2010


Hello, all.  We're finally starting to work our way thoroughly through
the x2go scripts and were a little confused by x2gosessionlimit.  Given
the following logic:

my $runningsessions=`x2golistsessions --all-servers`;
my @sessions=split("\n",$runningsessions);
my $scount=@sessions;

my $strlimit=$Config->param("limit users.$uname");

if($strlimit ne "")
{
    if($strlimit == 0)
    {
         print "0\n";
         exit 0;
    }
    if($strlimit <= $scount)
    {
        print "$strlimit\n";
        exit 0;
    }
    print "$strlimit\n";
    exit 0;
}

If a user is limited to the 3 sessions and x2golistsessions returns 1,
$strlimit is ne "" so we will enter the block.  It is neither 0 nor <= 1
so we will print "3\n".  Doesn't this cause x2gostartagent to exit with
an error?

LIMIT=`x2gosessionlimit`
LWORD=`echo $LIMIT | awk '{print $1}'`

if [ "$LWORD" == "LIMIT" ]
then
   echo  $LIMIT
   exit -1
fi


Thanks - John




More information about the x2go-dev mailing list