summaryrefslogtreecommitdiff
path: root/pkg/rootless/rootless_linux.c
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 /pkg/rootless/rootless_linux.c
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 'pkg/rootless/rootless_linux.c')
-rw-r--r--pkg/rootless/rootless_linux.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c
index e894328ce..d78d95453 100644
--- a/pkg/rootless/rootless_linux.c
+++ b/pkg/rootless/rootless_linux.c
@@ -107,6 +107,10 @@ reexec_userns_join (int userns)
_exit (EXIT_FAILURE);
close (userns);
+ if (setresgid (0, 0, 0) < 0 ||
+ setresuid (0, 0, 0) < 0)
+ _exit (EXIT_FAILURE);
+
execvp (argv[0], argv);
_exit (EXIT_FAILURE);