X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fdbus-manager.c;h=925e87cc570da514efe31cb697c8f594c6af6ccb;hp=33dcb56c09af48a36a63d498310afd962906ca14;hb=e616d1c6745f6a6df5a49a3957bd06aa8bd4648b;hpb=50913bc0c8ced894ceabc7e893c0fdf73af9a261 diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 33dcb56c0..925e87cc5 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -114,7 +114,9 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ + " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -142,7 +144,7 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -225,7 +227,6 @@ " \n" \ " \n" \ " \n" \ - " \n" \ " \n" \ " \n" \ " \n" \ @@ -243,23 +244,12 @@ " \n" \ " \n" \ " \n" \ - " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ - " \n" \ - " \n" - -#ifdef HAVE_SYSV_COMPAT -#define BUS_MANAGER_INTERFACE_PROPERTIES_SYSV \ - " \n" \ - " \n" \ - " \n" -#else -#define BUS_MANAGER_INTERFACE_PROPERTIES_SYSV -#endif + " \n" #define BUS_MANAGER_INTERFACE_END \ " \n" @@ -269,7 +259,6 @@ BUS_MANAGER_INTERFACE_METHODS \ BUS_MANAGER_INTERFACE_SIGNALS \ BUS_MANAGER_INTERFACE_PROPERTIES_GENERAL \ - BUS_MANAGER_INTERFACE_PROPERTIES_SYSV \ BUS_MANAGER_INTERFACE_END #define INTROSPECTION_BEGIN \ @@ -289,7 +278,6 @@ const char bus_manager_interface[] _introspect_("Manager") = BUS_MANAGER_INTERFACE; -static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs); static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_output, ExecOutput); static int bus_manager_append_tainted(DBusMessageIter *i, const char *property, void *data) { @@ -508,20 +496,6 @@ static int bus_manager_send_unit_files_changed(Manager *m) { return r; } -static int bus_manager_append_have_watchdog(DBusMessageIter *i, const char *property, void *data) { - dbus_bool_t b; - - assert(i); - assert(property); - - b = access("/dev/watchdog", F_OK) >= 0; - - if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b)) - return -ENOMEM; - - return 0; -} - static int bus_manager_set_runtime_watchdog_usec(DBusMessageIter *i, const char *property, void *data) { uint64_t *t = data; @@ -546,7 +520,6 @@ static const BusProperty bus_systemd_properties[] = { }; static const BusProperty bus_manager_properties[] = { - { "RunningAs", bus_manager_append_running_as, "s", offsetof(Manager, running_as) }, { "Tainted", bus_manager_append_tainted, "s", 0 }, { "InitRDTimestamp", bus_property_append_uint64, "t", offsetof(Manager, initrd_timestamp.realtime) }, { "InitRDTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, initrd_timestamp.monotonic) }, @@ -565,19 +538,12 @@ static const BusProperty bus_manager_properties[] = { { "ConfirmSpawn", bus_property_append_bool, "b", offsetof(Manager, confirm_spawn) }, { "ShowStatus", bus_property_append_bool, "b", offsetof(Manager, show_status) }, { "UnitPath", bus_property_append_strv, "as", offsetof(Manager, lookup_paths.unit_path), true }, - { "NotifySocket", bus_property_append_string, "s", offsetof(Manager, notify_socket), true }, { "ControlGroupHierarchy", bus_property_append_string, "s", offsetof(Manager, cgroup_hierarchy), true }, { "DefaultControllers", bus_property_append_strv, "as", offsetof(Manager, default_controllers), true }, { "DefaultStandardOutput", bus_manager_append_exec_output, "s", offsetof(Manager, default_std_output) }, { "DefaultStandardError", bus_manager_append_exec_output, "s", offsetof(Manager, default_std_error) }, { "RuntimeWatchdogUSec", bus_property_append_usec, "t", offsetof(Manager, runtime_watchdog), false, bus_manager_set_runtime_watchdog_usec }, { "ShutdownWatchdogUSec", bus_property_append_usec, "t", offsetof(Manager, shutdown_watchdog), false, bus_property_set_usec }, - { "HaveWatchdog", bus_manager_append_have_watchdog, "b", 0 }, -#ifdef HAVE_SYSV_COMPAT - { "SysVConsole", bus_property_append_bool, "b", offsetof(Manager, sysv_console) }, - { "SysVInitPath", bus_property_append_strv, "as", offsetof(Manager, lookup_paths.sysvinit_path), true }, - { "SysVRcndPath", bus_property_append_strv, "as", offsetof(Manager, lookup_paths.sysvrcnd_path), true }, -#endif { NULL, } }; @@ -1196,10 +1162,10 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBUS_TYPE_INVALID)) return bus_send_error_reply(connection, message, &error, -EINVAL); - if (path_equal(switch_root, "/") || !is_path(switch_root)) + if (path_equal(switch_root, "/") || !path_is_absolute(switch_root)) return bus_send_error_reply(connection, message, NULL, -EINVAL); - if (!isempty(switch_root_init) && !is_path(switch_root_init)) + if (!isempty(switch_root_init) && !path_is_absolute(switch_root_init)) return bus_send_error_reply(connection, message, NULL, -EINVAL); if (m->running_as != MANAGER_SYSTEM) { @@ -1213,7 +1179,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, else { char *p; - p = join(switch_root, "/", switch_root_init, NULL); + p = strjoin(switch_root, "/", switch_root_init, NULL); if (!p) goto oom; @@ -1592,6 +1558,11 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, job_type = JOB_RELOAD; } + if (job_type == JOB_STOP && u->load_state == UNIT_ERROR && unit_active_state(u) == UNIT_INACTIVE) { + dbus_set_error(&error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not loaded.", name); + return bus_send_error_reply(connection, message, &error, -EPERM); + } + if ((job_type == JOB_START && u->refuse_manual_start) || (job_type == JOB_STOP && u->refuse_manual_stop) || ((job_type == JOB_RESTART || job_type == JOB_TRY_RESTART) &&