Commit fc373635 authored by Leigh Stoller's avatar Leigh Stoller

Add SUEXEC function, which encaps running a tb program as a user.

Program must exist in the testbed bin directory.
parent 87ca3c61
......@@ -156,6 +156,29 @@ function PAGEFOOTER() {
</html>\n";
}
#
# Run a program as a user.
#
function SUEXEC($uid, $gid, $cmdandargs, $die) {
global $TBBIN_DIR;
$output = array();
$retval = 0;
$result = exec("$TBBIN_DIR/suexec $uid $gid $cmdandargs",
$output, $retval);
if ($retval) {
$foo = "";
for ($i = 0; $i < count($output); $i++) {
$foo = "$foo $output[$i]";
}
TBERROR("suexec failure. Cmd was \"$cmdandargs\". Error output:\n\n".
"$foo", $die);
}
return $retval;
}
#
# Beware empty spaces (cookies)!
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment