summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-04-20 09:44:37 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-24 14:28:33 +0000
commitcf41dc70b3078a833b323808c26d3a6ab0b25bd7 (patch)
treef7b301df9b7a381e4e471573f69eef1a30bfa04c /libpod/container_internal.go
parente76caee3383e3fe95bea197ea043e7abce9afa5c (diff)
downloadpodman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.tar.gz
podman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.tar.bz2
podman-cf41dc70b3078a833b323808c26d3a6ab0b25bd7.zip
Modify --user flag for podman create and run
If an integer is passed into the --user flag, i.e --user=1234 don't look up the user in /etc/passwd, just assign the integer as the uid. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #652 Approved by: mheon
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 62960fa0f..561b8853d 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -9,7 +9,6 @@ import (
"os"
"path/filepath"
"regexp"
- "strconv"
"strings"
"syscall"
"time"
@@ -956,17 +955,17 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
return nil, errors.Wrapf(ErrCtrStateInvalid, "container %s must be mounted in order to add additional groups", c.ID())
}
for _, group := range c.config.Groups {
- _, gid, err := chrootuser.GetUser(c.state.Mountpoint, strconv.Itoa(int(g.Spec().Process.User.UID))+":"+group)
+ gid, err := chrootuser.GetGroup(c.state.Mountpoint, group)
if err != nil {
return nil, err
}
- g.AddProcessAdditionalGid(uint32(gid))
+ g.AddProcessAdditionalGid(gid)
}
}
// Look up and add groups the user belongs to
groups, err := chrootuser.GetAdditionalGroupsForUser(c.state.Mountpoint, uint64(g.Spec().Process.User.UID))
- if err != nil {
+ if err != nil && err != chrootuser.ErrNoSuchUser {
return nil, err
}
for _, gid := range groups {