Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
fc373635
Commit
fc373635
authored
Nov 30, 2000
by
Leigh B. Stoller
Browse files
Add SUEXEC function, which encaps running a tb program as a user.
Program must exist in the testbed bin directory.
parent
87ca3c61
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/defs.php3
View file @
fc373635
...
@@ -156,6 +156,29 @@ function PAGEFOOTER() {
...
@@ -156,6 +156,29 @@ function PAGEFOOTER() {
</html>
\n
"
;
</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)!
# Beware empty spaces (cookies)!
#
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment