basic: when parsing verb command lines, optionally shortcut them in chroot() environments
This adds some basic infrastructure in order to fix #2015.
This commit is contained in:
@@ -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 {
|
||||
|
||||
+2
-1
@@ -22,7 +22,8 @@
|
||||
***/
|
||||
|
||||
#define VERB_ANY ((unsigned) -1)
|
||||
#define VERB_DEFAULT 1
|
||||
#define VERB_DEFAULT 1U
|
||||
#define VERB_NOCHROOT 2U
|
||||
|
||||
typedef struct {
|
||||
const char *verb;
|
||||
|
||||
Reference in New Issue
Block a user