X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fdbus-manager.c;h=f1e344c180edeed5dbe30111c5744fdf4ca15fa8;hb=bdd13f6be4b588568683a1ab54f421fc6a636dbb;hp=b7978e67005047b5f4eb3398c7059e37618d6102;hpb=556089dc57b10a12a03edd3d3e90ca17398ad206;p=elogind.git diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index b7978e670..f1e344c18 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -31,6 +31,7 @@ #include "hwclock.h" #include "path-util.h" #include "virt.h" +#include "architecture.h" #include "env-util.h" #include "dbus.h" #include "dbus-manager.h" @@ -89,6 +90,21 @@ static int property_get_virtualization( return sd_bus_message_append(reply, "s", id); } +static int property_get_architecture( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + assert(bus); + assert(reply); + + return sd_bus_message_append(reply, "s", architecture_to_string(uname_architecture())); +} + static int property_get_tainted( sd_bus *bus, const char *path, @@ -547,7 +563,7 @@ static int method_start_transient_unit(sd_bus *bus, sd_bus_message *message, voi return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit type."); if (!unit_vtable[t]->can_transient) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit type %s does not support transient units."); + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit type %s does not support transient units.", unit_type_to_string(t)); mode = job_mode_from_string(smode); if (mode < 0) @@ -873,7 +889,7 @@ static int method_create_snapshot(sd_bus *bus, sd_bus_message *message, void *us Manager *m = userdata; const char *name; int cleanup; - Snapshot *s; + Snapshot *s = NULL; int r; assert(bus); @@ -1338,7 +1354,7 @@ static int send_unit_files_changed(sd_bus *bus, const char *destination, void *u assert(bus); - r = sd_bus_message_new_signal(bus, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "UnitFilesChanged", &message); + r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "UnitFilesChanged"); if (r < 0) return r; @@ -1405,6 +1421,9 @@ static int method_enable_unit_files_generic( sd_bus_error *error) { _cleanup_strv_free_ char **l = NULL; +#ifdef HAVE_SELINUX + char **i; +#endif UnitFileChange *changes = NULL; unsigned n_changes = 0; UnitFileScope scope; @@ -1414,14 +1433,23 @@ static int method_enable_unit_files_generic( assert(message); assert(m); - r = selinux_access_check(bus, message, verb, error); - if (r < 0) - return r; - r = sd_bus_message_read_strv(message, &l); if (r < 0) return r; +#ifdef HAVE_SELINUX + STRV_FOREACH(i, l) { + Unit *u; + + u = manager_get_unit(m, *i); + if (u) { + r = selinux_unit_access_check(u, bus, message, verb, error); + if (r < 0) + return r; + } + } +#endif + r = sd_bus_message_read(message, "bb", &runtime, &force); if (r < 0) return r; @@ -1537,6 +1565,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_PROPERTY("Version", "s", property_get_version, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Features", "s", property_get_features, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Virtualization", "s", property_get_virtualization, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("Architecture", "s", property_get_architecture, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Tainted", "s", property_get_tainted, 0, SD_BUS_VTABLE_PROPERTY_CONST), BUS_PROPERTY_DUAL_TIMESTAMP("FirmwareTimestamp", offsetof(Manager, firmware_timestamp), SD_BUS_VTABLE_PROPERTY_CONST), BUS_PROPERTY_DUAL_TIMESTAMP("LoaderTimestamp", offsetof(Manager, loader_timestamp), SD_BUS_VTABLE_PROPERTY_CONST), @@ -1565,6 +1594,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_get_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("ControlGroup", "s", NULL, offsetof(Manager, cgroup_root), 0), SD_BUS_METHOD("GetUnit", "s", "o", method_get_unit, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetUnitByPID", "u", "o", method_get_unit_by_pid, SD_BUS_VTABLE_UNPRIVILEGED), @@ -1668,7 +1698,7 @@ static int send_finished(sd_bus *bus, const char *destination, void *userdata) { assert(bus); assert(times); - r = sd_bus_message_new_signal(bus, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartupFinished", &message); + r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartupFinished"); if (r < 0) return r; @@ -1704,7 +1734,7 @@ static int send_reloading(sd_bus *bus, const char *destination, void *userdata) assert(bus); - r = sd_bus_message_new_signal(bus, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "Reloading", &message); + r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "Reloading"); if (r < 0) return r;