diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-02-18 11:41:28 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-02-18 11:43:18 +0100 |
commit | 70244d1d25eb80b57e160ea004d0e6bf793d4caf (patch) | |
tree | 426754a172acd4d9fadf46e120afc9e26e653e08 /src/machine/machined-dbus.c | |
parent | c0765ddb74f20046c406a3ac99f34719d767f151 (diff) |
machined: open up most of machined's commands to unprivileged clients via PolicyKit
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 155146b938..7a9ac2f349 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -622,6 +622,7 @@ static int method_remove_image(sd_bus *bus, sd_bus_message *message, void *userd if (r == 0) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name); + i->userdata = userdata; return bus_image_method_remove(bus, message, i, error); } @@ -646,6 +647,7 @@ static int method_rename_image(sd_bus *bus, sd_bus_message *message, void *userd if (r == 0) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", old_name); + i->userdata = userdata; return bus_image_method_rename(bus, message, i, error); } @@ -668,6 +670,7 @@ static int method_clone_image(sd_bus *bus, sd_bus_message *message, void *userda if (r == 0) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", old_name); + i->userdata = userdata; return bus_image_method_clone(bus, message, i, error); } @@ -690,6 +693,7 @@ static int method_mark_image_read_only(sd_bus *bus, sd_bus_message *message, voi if (r == 0) return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name); + i->userdata = userdata; return bus_image_method_mark_read_only(bus, message, i, error); } @@ -704,19 +708,19 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_METHOD("CreateMachineWithNetwork", "sayssusaia(sv)", "o", method_create_machine_with_network, 0), SD_BUS_METHOD("RegisterMachine", "sayssus", "o", method_register_machine, 0), SD_BUS_METHOD("RegisterMachineWithNetwork", "sayssusai", "o", method_register_machine_with_network, 0), - SD_BUS_METHOD("TerminateMachine", "s", NULL, method_terminate_machine, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)), - SD_BUS_METHOD("KillMachine", "ssi", NULL, method_kill_machine, SD_BUS_VTABLE_CAPABILITY(CAP_KILL)), + SD_BUS_METHOD("TerminateMachine", "s", NULL, method_terminate_machine, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("KillMachine", "ssi", NULL, method_kill_machine, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetMachineAddresses", "s", "a(iay)", method_get_machine_addresses, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetMachineOSRelease", "s", "a{ss}", method_get_machine_os_release, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("OpenMachinePTY", "s", "hs", method_open_machine_pty, 0), SD_BUS_METHOD("OpenMachineLogin", "s", "hs", method_open_machine_login, SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD("BindMountMachine", "sssbb", NULL, method_bind_mount_machine, 0), - SD_BUS_METHOD("CopyFromMachine", "sss", NULL, method_copy_machine, 0), - SD_BUS_METHOD("CopyToMachine", "sss", NULL, method_copy_machine, 0), - SD_BUS_METHOD("RemoveImage", "s", NULL, method_remove_image, 0), - SD_BUS_METHOD("RenameImage", "ss", NULL, method_rename_image, 0), - SD_BUS_METHOD("CloneImage", "ssb", NULL, method_clone_image, 0), - SD_BUS_METHOD("MarkImageReadOnly", "sb", NULL, method_mark_image_read_only, 0), + SD_BUS_METHOD("BindMountMachine", "sssbb", NULL, method_bind_mount_machine, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("CopyFromMachine", "sss", NULL, method_copy_machine, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("CopyToMachine", "sss", NULL, method_copy_machine, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("RemoveImage", "s", NULL, method_remove_image, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("RenameImage", "ss", NULL, method_rename_image, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("CloneImage", "ssb", NULL, method_clone_image, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("MarkImageReadOnly", "sb", NULL, method_mark_image_read_only, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_SIGNAL("MachineNew", "so", 0), SD_BUS_SIGNAL("MachineRemoved", "so", 0), SD_BUS_VTABLE_END |