Commit 9946fd2b authored by Robert Ricci's avatar Robert Ricci

Switch to the user before we run external tools, which is safer, and

allows us to remove the tempfiles created by them.
parent 59616489
......@@ -247,6 +247,12 @@ MOTE: foreach my $mote (@motes) {
}
}
}
#
# Flip to the user's ID before running these things
#
my $oldEUID = $EUID;
$EUID = $UID;
if (exists $moteIDs{$mote}) {
print "Setting id for $mote to $moteIDs{$mote}\n";
if (system "$SETID --exe $filename $tmpexe $moteIDs{$mote}") {
......@@ -260,6 +266,10 @@ MOTE: foreach my $mote (@motes) {
next MOTE;
}
$uploadfile = $tmpfile;
#
# And then flip back
#
$EUID = $oldEUID;
if ($processedfile eq $tmpexe) {
unlink $tmpexe;
......@@ -434,7 +444,7 @@ MOTE: foreach my $mote (@motes) {
# Clean up the tempfile
#
if ($tmpfile) {
unlink $tmpfile;
system "rm -f $tmpfile";
}
# XXX - We have to reboot stargates after loading the mote. Disgusting,
......
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