diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-05 22:54:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 22:54:39 +0200 |
commit | f48b1639348da2e398c4e30e10f542dec02c69d5 (patch) | |
tree | c7c9d9472b4ad8e1daea6c37c69c3adc0210bcc1 /pkg | |
parent | a0bf02684ecb76557cebb369011191525f066c7f (diff) | |
parent | 30bd8ed506cd497d7790e6e4cc7258c043cc9315 (diff) | |
download | podman-f48b1639348da2e398c4e30e10f542dec02c69d5.tar.gz podman-f48b1639348da2e398c4e30e10f542dec02c69d5.tar.bz2 podman-f48b1639348da2e398c4e30e10f542dec02c69d5.zip |
Merge pull request #7919 from rhatdan/subuid
Fix handling of CheckRootlessUIDRange
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/util/utils_linux.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/util/utils_linux.go b/pkg/util/utils_linux.go index 29b16f765..e4957f442 100644 --- a/pkg/util/utils_linux.go +++ b/pkg/util/utils_linux.go @@ -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 } |