summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-10-25 13:39:25 -0500
committerbaude <bbaude@redhat.com>2018-10-29 08:59:46 -0500
commit1dd7f13dfbc1dd377eabace0239b1c05cd60b144 (patch)
treea7d99c70e882fcc1440023c0a5aaf917d5e886e3 /libpod/container_api.go
parentaa853b20913696286fff05a0e1572421e26179a2 (diff)
downloadpodman-1dd7f13dfbc1dd377eabace0239b1c05cd60b144.tar.gz
podman-1dd7f13dfbc1dd377eabace0239b1c05cd60b144.tar.bz2
podman-1dd7f13dfbc1dd377eabace0239b1c05cd60b144.zip
get user and group information using securejoin and runc's user library
for the purposes of performance and security, we use securejoin to contstruct the root fs's path so that symlinks are what they appear to be and no pointing to something naughty. then instead of chrooting to parse /etc/passwd|/etc/group, we now use the runc user/group methods which saves us quite a bit of performance. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 41a131ea2..83f93cf9e 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -10,8 +10,8 @@ import (
"time"
"github.com/containers/libpod/libpod/driver"
- "github.com/containers/libpod/pkg/chrootuser"
"github.com/containers/libpod/pkg/inspect"
+ "github.com/containers/libpod/pkg/lookup"
"github.com/containers/storage/pkg/stringid"
"github.com/docker/docker/daemon/caps"
"github.com/pkg/errors"
@@ -292,13 +292,13 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
// the host
hostUser := ""
if user != "" {
- uid, gid, err := chrootuser.GetUser(c.state.Mountpoint, user)
+ execUser, err := lookup.GetUserGroupInfo(c.state.Mountpoint, user, nil)
if err != nil {
- return errors.Wrapf(err, "error getting user to launch exec session as")
+ return err
}
// runc expects user formatted as uid:gid
- hostUser = fmt.Sprintf("%d:%d", uid, gid)
+ hostUser = fmt.Sprintf("%d:%d", execUser.Uid, execUser.Gid)
}
// Generate exec session ID