aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-08-31 09:31:34 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-04 14:36:57 +0000
commit807f6f8d8f98422cfcfe7e474e26a985d951af4d (patch)
tree6010ce20c6ce8f247cbb8b3e6f29c294521c82ad /test
parentbdee681409f595443d4f3cb4f08b76d24139d6a8 (diff)
downloadpodman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.tar.gz
podman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.tar.bz2
podman-807f6f8d8f98422cfcfe7e474e26a985d951af4d.zip
rootless: check uid with Geteuid() instead of Getuid()
change the tests to use chroot to set a numeric UID/GID. Go syscall.Credential doesn't change the effective UID/GID of the process. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1372 Approved by: mheon
Diffstat (limited to 'test')
-rw-r--r--test/e2e/libpod_suite_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 8c9183450..dcc5fd913 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -10,7 +10,6 @@ import (
"os/exec"
"path/filepath"
"strings"
- "syscall"
"testing"
"time"
@@ -190,11 +189,13 @@ func (p *PodmanTest) PodmanAsUser(args []string, uid, gid uint32, env []string)
} else {
fmt.Printf("Running: (env: %v) %s %s\n", env, p.PodmanBinary, strings.Join(podmanOptions, " "))
}
- command := exec.Command(p.PodmanBinary, podmanOptions...)
+ var command *exec.Cmd
if uid != 0 || gid != 0 {
- command.SysProcAttr = &syscall.SysProcAttr{}
- command.SysProcAttr.Credential = &syscall.Credential{Uid: uid, Gid: gid}
+ nsEnterOpts := append([]string{"--userspec", fmt.Sprintf("%d:%d", uid, gid), "/", p.PodmanBinary}, podmanOptions...)
+ command = exec.Command("chroot", nsEnterOpts...)
+ } else {
+ command = exec.Command(p.PodmanBinary, podmanOptions...)
}
if env != nil {
command.Env = env