stta/stta/sess_mgmt.cgi
2021-10-01 20:35:43 +01:00

70 lines
2.2 KiB
Perl
Executable File

#!/usr/bin/perl
# sess_mgmt.cgi
# Manage Services with Tarantella Sessions
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo --- license GNU GPL
# stta: (@#) 1.31051043346- [2004_01_29_102036]
require './stta-lib.pl';
if ($access{'sessions'} ne 1 ) { &redirect("index.cgi"); }
&ReadParse();
if ( !$in{ob} ) { &redirect("sess_filter.cgi"); }
$obj=$in{ob};
if ( "$obj" eq "user" ) {
$str=$config{'tta_websessions_logout'}." \"".$in{objvalue}."\"\n";
}
if ( "$obj" eq "app" ) {
# $str=$config{'tta_sessions'}." logout \"".$in{objvalue}."\"\n";
$str="";
}
if ( "$obj" eq "appserv" ) {
# $str=$config{'tta_sessions'}." logout \"".$in{objvalue}."\"\n";
$str="";
}
if ( "$obj" eq "pe_id" ) {
$task_to_do="END: ".$in{objvalue};
$str=$config{'tta_emusessions_end'}." \"".$in{id}."\"\n";
}
&foreign_require("proc", "proc-lib.pl");
&headerstta($text{'index_mgmt_ttasess'}, "", "ttasess",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" );
# print "<hr><p>\n";
print "<table width=100% border>\n";
print "<tr $tb> <td><font color='$revtext'><b>$text{'titidx_ttasess'}</b></td> </tr>\n";
print "<tr><td><b> $task_to_do $in{objname} ( $in{grpname} ) </td></tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<hr>\n";
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><tr></table></table><hr><p>\n";
print "<A class=\"menu1\" href=\"javascript:self.close()\">".$text{'msg_close'}."</A>\n";
# &footer($config{'back_return'},$text{'index'});
do "footer.pl";
exit;