Commit 2f66c77a authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add the usual glist goo to make sure that all of the user's groups are

set properly.
parent eb843c05
......@@ -366,6 +366,26 @@ sub dosomething($$)
TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_gname) or
fatal("No such group $pid/$gid");
#
# Need the entire group list for the user, cause of subgroups, and cause
# thats the correct thing to do. Too bad perl does not have a getgrouplist
# function like the C library.
#
my $glist = `id -G $creator`;
if ($glist =~ /^([\d ]*)$/) {
$glist = $1;
}
else {
fatal("Unexpected results from 'id -G $creator': $glist");
}
#
# Remove current group from glist, then add gid twice at the front
# of the list. Order matters here, or we won't pick up all the
# groups we need.
#
$glist =~ s/ ?\b$unix_gid\b ?//;
$glist = $unix_gid . " " . $unix_gid . " " . $glist;
#
# Change the ownership of the log file before we flip.
#
......@@ -373,9 +393,11 @@ sub dosomething($$)
fatal("Could not chown $logname to $unix_uid/$unix_gid!");
# Flip to the user. We never flip back.
$EGID = $GID = $unix_gid;
$EUID = $UID = $unix_uid;
$ENV{'USER'} = $creator;
$GID = $unix_gid;
$EGID = $glist;
$EUID = $UID = $unix_uid;
$ENV{'USER'} = $creator;
$ENV{'LOGNAME'} = $creator;
if ($dowhat eq "start") {
startexp(%exphash);
......
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