Skip to content

Commit

Permalink
Merge pull request #5114 from kmk3/stop-warn-group-clean
Browse files Browse the repository at this point in the history
Stop warning on safe supplementary group clean
  • Loading branch information
netblue30 authored Apr 25, 2022
2 parents 9633d7d + 30c1534 commit f35ac46
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/firejail/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,19 @@ static void clean_supplementary_groups(gid_t gid) {
assert(cfg.username);
gid_t groups[MAX_GROUPS];
int ngroups = MAX_GROUPS;

if (arg_nogroups && check_can_drop_all_groups()) {
if (setgroups(0, NULL) < 0)
errExit("setgroups");
if (arg_debug)
printf("No supplementary groups\n");
return;
}

int rv = getgrouplist(cfg.username, gid, groups, &ngroups);
if (rv == -1)
goto clean_all;

if (arg_nogroups && check_can_drop_all_groups())
goto clean_all;

// clean supplementary group list
gid_t new_groups[MAX_GROUPS];
int new_ngroups = 0;
Expand Down

0 comments on commit f35ac46

Please sign in to comment.