Skip to content

Commit

Permalink
Set group id before user id in child process
Browse files Browse the repository at this point in the history
Should fix issue where the group id wasn't getting set at all.
  • Loading branch information
davmac314 committed Jun 23, 2020
1 parent 5469480 commit f823b72
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/run-child-proc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ void base_process_service::run_child_proc(run_proc_params params) noexcept

if (uid != uid_t(-1)) {
err.stage = exec_stage::SET_UIDGID;
if (setreuid(uid, uid) != 0) goto failure_out;
// We must set group first (i.e. before we drop privileges)
if (setregid(gid, gid) != 0) goto failure_out;
if (setreuid(uid, uid) != 0) goto failure_out;
}

sigprocmask(SIG_SETMASK, &sigwait_set, nullptr);
Expand Down

0 comments on commit f823b72

Please sign in to comment.