Commit a58eaa28 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

fs-mistrust: add getegid() to getgrouplist() output.

This fixes a unit test failure in weird environments (like some
containers) where the current effective GID is not included in the
list of current groups.

Closes #487.

Bug reported by @sjm217.
parent ed518c5a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -79,6 +79,12 @@ fn cur_groups() -> Vec<u32> {
    if n_groups2 < n_groups {
        buf.resize(n_groups2 as usize, 0);
    }
    // It's not guaranteed that our current GID is necessarily one of our
    // current groups.  So, we add it.
    let cur_gid = users::get_current_gid();
    if !buf.contains(&cur_gid) {
        buf.push(cur_gid);
    }
    buf
}