Skip to content

Commit

Permalink
user: Always return supplementary groups
Browse files Browse the repository at this point in the history
The caller can ignore it if they don't care about using them.

Signed-off-by: Mrunal Patel <[email protected]>
  • Loading branch information
mrunalp committed Oct 17, 2018
1 parent 58592df commit d200a6e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libcontainer/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,10 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) (

// Okay, so it's numeric. We can just roll with this.
}
} else if len(groups) > 0 {
// Supplementary group ids only make sense if in the implicit form.
user.Sgids = make([]int, len(groups))
for i, group := range groups {
user.Sgids[i] = group.Gid
}
if len(groups) > 0 {
for _, group := range groups {
user.Sgids = append(user.Sgids, group.Gid)
}
}
}
Expand Down

0 comments on commit d200a6e

Please sign in to comment.