summaryrefslogtreecommitdiff
path: root/src/basic/verbs.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-01-28 19:30:56 +0100
committerLennart Poettering <lennart@poettering.net>2016-01-29 15:16:56 +0100
commita16f96cd56c6ee251f69fdb2395ad0dcb51abac8 (patch)
treed86e27b747a2a0d66e85d2c857df0749db1deb9b /src/basic/verbs.c
parenta5a5f03382ba7733670d7d226ce75f98dd64e554 (diff)
basic: when parsing verb command lines, optionally shortcut them in chroot() environments
This adds some basic infrastructure in order to fix #2015.
Diffstat (limited to 'src/basic/verbs.c')
-rw-r--r--src/basic/verbs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/verbs.c b/src/basic/verbs.c
index 7feb47c48e..6dded9fb77 100644
--- a/src/basic/verbs.c
+++ b/src/basic/verbs.c
@@ -28,6 +28,7 @@
#include "macro.h"
#include "string-util.h"
#include "verbs.h"
+#include "virt.h"
int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata) {
const Verb *verb;
@@ -84,6 +85,11 @@ int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata) {
return -EINVAL;
}
+ if ((verb->flags & VERB_NOCHROOT) && running_in_chroot() > 0) {
+ log_info("Running in chroot, ignoring request.");
+ return 0;
+ }
+
if (name)
return verb->dispatch(left, argv + optind, userdata);
else {