diff --git a/crates/fs-mistrust/src/user.rs b/crates/fs-mistrust/src/user.rs index 9fa09e12e..2d98fbda7 100644 --- a/crates/fs-mistrust/src/user.rs +++ b/crates/fs-mistrust/src/user.rs @@ -94,31 +94,8 @@ fn get_own_username(userdb: &U) -> io::Result io::Result> { - let n_groups = unsafe { libc::getgroups(0, std::ptr::null_mut()) }; - if n_groups <= 0 { - return Ok(Vec::new()); - } - let mut buf: Vec = vec![0; n_groups as usize]; - let n_groups2 = unsafe { libc::getgroups(buf.len() as i32, buf.as_mut_ptr()) }; - if n_groups2 <= 0 { - return Ok(Vec::new()); - } - 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 = PwdGrp.getgid(); - if !buf.contains(&cur_gid) { - buf.push(cur_gid); - } - Ok(buf) + PwdGrp.getgroups() } /// A user that we can be configured to trust.