Merge pull request #2109 from giuseppe/skip-nogroup

userns: skip "nogroup"
This commit is contained in:
openshift-merge-bot[bot] 2024-09-24 18:01:16 +00:00 committed by GitHub
commit 5924c6f0ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func parseMountedFiles(containerMount, passwdFile, groupFile string) uint32 {
for _, u := range users {
// Skip the "nobody" user otherwise we end up with 65536
// ids with most images
if u.Name == "nobody" {
if u.Name == "nobody" || u.Name == "nogroup" {
continue
}
if u.Uid > size && u.Uid != nobodyUser {
@ -114,7 +114,7 @@ func parseMountedFiles(containerMount, passwdFile, groupFile string) uint32 {
groups, err := libcontainerUser.ParseGroupFile(groupFile)
if err == nil {
for _, g := range groups {
if g.Name == "nobody" {
if g.Name == "nobody" || g.Name == "nogroup" {
continue
}
if g.Gid > size && g.Gid != nobodyUser {

View File

@ -228,6 +228,15 @@ nobody:x:65534:`,
groupContent: "FOOBAR",
expectedMax: 0,
},
{
name: "nogroup ignored",
passwdContent: "",
groupContent: `
root:x:0:
admin:x:4000:
nogroup:x:65533:`,
expectedMax: 4001,
},
}
for _, tt := range tests {