Skip to content

Commit

Permalink
Unset all auxiliary groups and simplify code
Browse files Browse the repository at this point in the history
Since `rungid` is already set as primary group, there's no
reason to also set it as auxiliary group.

Closes #2589
  • Loading branch information
eldering committed Nov 22, 2024
1 parent 5533e60 commit bfbea34
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions judge/runguard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,7 @@ void setrestrictions()
/* Set group-id (must be root for this, so before setting user). */
if ( use_group ) {
if ( setgid(rungid) ) error(errno,"cannot set group ID to `%d'",rungid);
gid_t aux_groups[1];
aux_groups[0] = rungid;
if ( setgroups(1, aux_groups) ) error(errno,"cannot clear auxiliary groups");
if ( setgroups(0, NULL) ) error(errno,"cannot clear auxiliary groups");

verbose("using group ID `%d'",rungid);
}
Expand Down

0 comments on commit bfbea34

Please sign in to comment.