#!/usr/bin/perl # runfile.cgi # RUN file for Services with Tarantella # 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'; &foreign_require("proc", "proc-lib.pl"); &ReadParse(); if ( ! $access{'supervision'} ) { &redirect("index.cgi"); } $postform = ($in{postform}) ? $in{postform} : "runfile"; $cgiPost = ($in{cgiPost}) ? $in{cgiPost} : "file"; $cgiName = ($in{cgiName}) ? $in{cgiName} : "runfile.cgi"; $wkdir = ($in{wkdir}) ? $in{wkdir} : eval("\$config{'$postform"."_path'}"); if ( ! $in{fName} ) { &redirect("index.cgi"); } if ( $postform eq "filemgr" || $postform eq "modfile" ) { $postform="runfile"; } $filePerm= $in{'filePerm'}; $fName=$in{fName}; $cmd=$in{cmd}; if ( $in{fPerm} ) { if ( substr($in{fPerm},0,1) ne "-" ) { @l_target = split(/,/,$text{'f_perm_value'}, -1); @l_target_tit = split(/,/,$text{'f_perm_desc'}, -1); $nItems=0; foreach $item (@l_target) { if ( $item eq $in{fPerm} ) { $fMode=$l_target_tit[$nItems]; $fPerm=substr($fMode,3,1); last; } print $l_target_tit{$nItems}; $nItems++; } } else { $fMode=$in{fPerm}; $fPerm=substr($fMode,3,1); } } $perm=$in{perm}; if ( $perm ne "new" && substr($in{fPerm},1,3) eq "rwx" ) { $perm="all"; } &headerstta(eval("\$text{'index_$postform'}"), "", $postform ,undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" ); print "\n"; print "\n"; print "
"; if ( $postform ne "runfile" ) { print $text{'execute'}; } print " ".eval("\$text{'titidx_$postform'}")."
\n"; if ( $fPerm ne "x" ) { print ""; print &text('file_err',$text{'execute'},$wkdir,$fName,$fMode); print "\n"; &footHere; exit 1; } $f_path=$wkdir."/".$fName; if ( -x $f_path ) { print "\n"; } else { print "\n"; } print ""; print "\n"; print "
$fPerm
$text{'execute'} $wkdir/$fName\n"; if ( $debug gt 0 ) { print "    ($fMode) ";} $str=$f_path; $exec_str="$text{execute} ($perm)"; $cmd_str="$f_path $fMode"; if (&run_cmd($str)) { print "
-- oOo --
$text{'index_cmderr'}
".&text('viewlog_action',$stta_sid)."
"; } else { print &text('file_errerun',$wkdir,$fName); } print "

\n"; &footer($config{'back_return'},$text{'index'}); print "

\n"; do "footer.pl"; exit;