wip: comment out primary gid exception

This commit is contained in:
Motiejus Jakštys 2022-07-15 09:29:42 +03:00
parent bd13e6a322
commit 4aee66fb11

View File

@ -167,11 +167,14 @@ pub fn init(
for (groupmembers) |member_name| { for (groupmembers) |member_name| {
if (name2user.get(member_name)) |user_idx| { if (name2user.get(member_name)) |user_idx| {
// If user is in a group of their primary gid,
// if user is in a group of their primary gid, // skip the membersip. This is what classical tools do
// skip the membersip. // (look at your etc/passwd), but not what Ours Truly
if (users.items(.gid)[user_idx] == groups.items(.gid)[i]) // nss implementation does.
continue; // - Uncomment this code to behave how Classics behave.
// - Leave commented to be compatible with Ours Truly NSS.
//if (users.items(.gid)[user_idx] == groups.items(.gid)[i])
// continue;
members.len += 1; members.len += 1;
members[members.len - 1] = user_idx; members[members.len - 1] = user_idx;
try user2groups[user_idx].append(allocator, @intCast(u32, i)); try user2groups[user_idx].append(allocator, @intCast(u32, i));