diff options
author | Ludwig Nussel <ludwig.nussel@suse.de> | 2022-12-28 14:00:35 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-12-29 13:29:25 +0100 |
commit | d353fcceb56634d0b05e83c2051f90785d98c646 (patch) | |
tree | f49d8c346a03170bd61cb9938a3f227373f3d904 /src/machine | |
parent | 790096852738b4961ffd8b10664a67b3f075d612 (diff) | |
download | systemd-d353fcceb56634d0b05e83c2051f90785d98c646.tar.gz |
machined: pass shell command line to polkit
Pass the joined arguments to polkit as command_line property like
pkexec does. Obviously not exactly perfect as it lacks quoting. Good
enough for polkit rules to check whether a program was called with
or without arguments though.
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machine-dbus.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 7a45811614..45bc056326 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -590,6 +590,7 @@ int bus_machine_method_open_shell(sd_bus_message *message, void *userdata, sd_bu sd_bus *container_bus = NULL; _cleanup_close_ int master = -EBADF, slave = -EBADF; _cleanup_strv_free_ char **env = NULL, **args_wire = NULL, **args = NULL; + _cleanup_free_ char *command_line = NULL; Machine *m = ASSERT_PTR(userdata); const char *p, *unit, *user, *path, *description, *utmp_id; int r; @@ -642,10 +643,14 @@ int bus_machine_method_open_shell(sd_bus_message *message, void *userdata, sd_bu if (!strv_env_is_valid(env)) return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment assignments"); + command_line = strv_join(args, " "); + if (!command_line) + return -ENOMEM; const char *details[] = { "machine", m->name, "user", user, "program", path, + "command_line", command_line, NULL }; |