summaryrefslogtreecommitdiffstats
path: root/sys-utils/nsenter.c
diff options
context:
space:
mode:
authorKarel Zak2015-01-08 12:27:59 +0100
committerKarel Zak2015-01-09 10:36:01 +0100
commit83fb8aa53d15dd7ee2c62bffa4fc04f70646650b (patch)
treee1a9180f256835935bfc14531bce988650d9d237 /sys-utils/nsenter.c
parentunshare: add --setgroups=deny|allow (diff)
downloadkernel-qcow2-util-linux-83fb8aa53d15dd7ee2c62bffa4fc04f70646650b.tar.gz
kernel-qcow2-util-linux-83fb8aa53d15dd7ee2c62bffa4fc04f70646650b.tar.xz
kernel-qcow2-util-linux-83fb8aa53d15dd7ee2c62bffa4fc04f70646650b.zip
nsenter: keep semantic consistent
The current nseneter behavior is inconsistent and depends on way how namespace is specified on command line # nsenter --user vs. # nseneter --user=filename if the namespace is specified by <filename> than nsenter does not do additinal setting and actions (e.g. does not call setgroups, setuid). This is bug. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/nsenter.c')
-rw-r--r--sys-utils/nsenter.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index e00a3e472..50f77f381 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -284,6 +284,15 @@ int main(int argc, char *argv[])
open_target_fd(&wd_fd, "cwd", NULL);
/*
+ * Update namespaces variable to contain all requested namespaces
+ */
+ for (nsfile = namespace_files; nsfile->nstype; nsfile++) {
+ if (nsfile->fd < 0)
+ continue;
+ namespaces |= nsfile->nstype;
+ }
+
+ /*
* Now that we know which namespaces we want to enter, enter them.
*/
for (nsfile = namespace_files; nsfile->nstype; nsfile++) {