#!/usr/bin/perl
# tta_sess.cgi
# Display Tarantella Services Sessions

 require './tarantella-lib.pl';
&foreign_require("proc", "proc-lib.pl");
&header($text{'index_ttasess'}, "", "ttasess");

 print "<hr><p>\n"; 
 print "<table width=100% border>\n";
 print "<tr $tb> <td><b>$text{'titidx_ttasess'}</b></td> </tr>\n";
 print "<tr $cb> <td><table width=100%>\n";
	print "<hr>\n";
	print "<tr><td>\n";
        $str=$config{'tta_sessions'};
 if ($str) {
        $| = 1;
        $temp = &tempname();
        open(TEMP, ">$temp");
        print TEMP "#!/bin/sh\n";
        print TEMP $env;
	print TEMP "export $export\n" if ($export);
	print TEMP "$str\n";
	close(TEMP);
	chmod(0777, $temp);
        print "<pre>\n"; 
	$got = &foreign_call("proc", "safe_process_exec",
	   		     "su root -c $temp", 0, 0,
                              STDOUT, undef, 0);   
	unlink($temp);
        &additional_log('tta_cmd', undef, $str);
        if (!$got) { print "<i>$text{'run_noout'}</i>\n"; }
        print "</pre>\n" 
        &webmin_log("exec", "command", "root", "$str");
} else {
     print "<b>$text{'index_cmderr'}</b>\n"; 
   
}
 print "<tr>\n";
 print "<tr>\n";
 print "<tr>\n";
 print "</table></table><p>\n";
 &footer($config{'back_return'},$text{'index'});
 do "footer.pl";
 exit;



