mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
rpc: Introduce CLI's --action-script analogue
Service shouldn't call client provided scripts, as it creates a security issue (client may be unpriviledged, while the service is). In order to let caller do what it would normally do with criu-scripts, make criu notify it about scripts. Caller then do whatever it needs and responds back. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
10
util.c
10
util.c
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "cr_options.h"
|
||||
#include "servicefd.h"
|
||||
#include "cr-service.h"
|
||||
|
||||
#define VMA_OPT_LEN 128
|
||||
|
||||
@@ -458,8 +459,13 @@ int run_scripts(char *action)
|
||||
}
|
||||
|
||||
list_for_each_entry(script, &opts.scripts, node) {
|
||||
pr_debug("\t[%s]\n", script->path);
|
||||
ret |= system(script->path);
|
||||
if (script->path == SCRIPT_RPC_NOTIFY) {
|
||||
pr_debug("\tRPC\n");
|
||||
ret |= send_criu_rpc_script(action, script->arg);
|
||||
} else {
|
||||
pr_debug("\t[%s]\n", script->path);
|
||||
ret |= system(script->path);
|
||||
}
|
||||
}
|
||||
|
||||
unsetenv("CRTOOLS_SCRIPT_ACTION");
|
||||
|
Reference in New Issue
Block a user