Merge pull request #7919 from rhatdan/subuid

Fix handling of CheckRootlessUIDRange
This commit is contained in:
OpenShift Merge Robot 2020-10-05 22:54:39 +02:00 committed by GitHub
commit f48b163934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -60,11 +60,12 @@ func CheckRootlessUIDRange(uid int) error {
if err != nil {
return err
}
total := 0
for _, u := range uids {
// add 1 since we also map in the user's own UID
if uid > u.Size+1 {
return errors.Errorf("requested user's UID %d is too large for the rootless user namespace", uid)
}
total += u.Size
}
if uid > total {
return errors.Errorf("requested user's UID %d is too large for the rootless user namespace", uid)
}
return nil
}