|
|
b12df0 |
From d375206fe822903b16f3b9006ea47ffd938d88cb Mon Sep 17 00:00:00 2001
|
|
|
b12df0 |
From: Deepak Rawat <drawat.floss@gmail.com>
|
|
|
b12df0 |
Date: Mon, 25 Jan 2021 09:14:08 -0800
|
|
|
b12df0 |
Subject: [PATCH] logind: Introduce RebootWithFlags and others
|
|
|
b12df0 |
|
|
|
b12df0 |
Add new systemd-logind WithFlags version for Reboot and others. These
|
|
|
b12df0 |
methods add a unit64 parameter, with which can send additional control flags.
|
|
|
b12df0 |
|
|
|
b12df0 |
(cherry picked from commit 00971ea5164e2e7a5f2d7ffe12a566b62d282556)
|
|
|
b12df0 |
|
|
|
b12df0 |
Related: #1269726
|
|
|
b12df0 |
---
|
|
|
b12df0 |
src/basic/login-util.h | 8 +
|
|
|
b12df0 |
src/login/logind-dbus.c | 498 +++++++++++++++++++++++++++++++-----
|
|
|
b12df0 |
src/systemctl/systemctl.c | 26 ++
|
|
|
b12df0 |
src/systemd/sd-bus-vtable.h | 19 +-
|
|
|
b12df0 |
4 files changed, 480 insertions(+), 71 deletions(-)
|
|
|
b12df0 |
|
|
|
b12df0 |
diff --git a/src/basic/login-util.h b/src/basic/login-util.h
|
|
|
b12df0 |
index e1e62e12b7..9832207458 100644
|
|
|
b12df0 |
--- a/src/basic/login-util.h
|
|
|
b12df0 |
+++ b/src/basic/login-util.h
|
|
|
b12df0 |
@@ -4,6 +4,14 @@
|
|
|
b12df0 |
#include <stdbool.h>
|
|
|
b12df0 |
#include <unistd.h>
|
|
|
b12df0 |
|
|
|
b12df0 |
+#define SD_LOGIND_ROOT_CHECK_INHIBITORS (UINT64_C(1) << 0)
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+/* For internal use only */
|
|
|
b12df0 |
+#define SD_LOGIND_INTERACTIVE (UINT64_C(1) << 63)
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+#define SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC (SD_LOGIND_ROOT_CHECK_INHIBITORS)
|
|
|
b12df0 |
+#define SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_ALL (SD_LOGIND_ROOT_CHECK_INHIBITORS|SD_LOGIND_INTERACTIVE)
|
|
|
b12df0 |
+
|
|
|
b12df0 |
bool session_id_valid(const char *id);
|
|
|
b12df0 |
|
|
|
b12df0 |
static inline bool logind_running(void) {
|
|
|
b12df0 |
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
|
|
|
b12df0 |
index 3f122fcbd9..0c43fbb3e0 100644
|
|
|
b12df0 |
--- a/src/login/logind-dbus.c
|
|
|
b12df0 |
+++ b/src/login/logind-dbus.c
|
|
|
b12df0 |
@@ -1698,14 +1698,14 @@ static int verify_shutdown_creds(
|
|
|
b12df0 |
Manager *m,
|
|
|
b12df0 |
sd_bus_message *message,
|
|
|
b12df0 |
InhibitWhat w,
|
|
|
b12df0 |
- bool interactive,
|
|
|
b12df0 |
const char *action,
|
|
|
b12df0 |
const char *action_multiple_sessions,
|
|
|
b12df0 |
const char *action_ignore_inhibit,
|
|
|
b12df0 |
+ uint64_t flags,
|
|
|
b12df0 |
sd_bus_error *error) {
|
|
|
b12df0 |
|
|
|
b12df0 |
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
|
|
|
b12df0 |
- bool multiple_sessions, blocked;
|
|
|
b12df0 |
+ bool multiple_sessions, blocked, interactive;
|
|
|
b12df0 |
uid_t uid;
|
|
|
b12df0 |
int r;
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1728,6 +1728,7 @@ static int verify_shutdown_creds(
|
|
|
b12df0 |
|
|
|
b12df0 |
multiple_sessions = r > 0;
|
|
|
b12df0 |
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
|
|
|
b12df0 |
+ interactive = flags & SD_LOGIND_INTERACTIVE;
|
|
|
b12df0 |
|
|
|
b12df0 |
if (multiple_sessions && action_multiple_sessions) {
|
|
|
b12df0 |
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_multiple_sessions, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
|
|
|
b12df0 |
@@ -1737,12 +1738,19 @@ static int verify_shutdown_creds(
|
|
|
b12df0 |
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
- if (blocked && action_ignore_inhibit) {
|
|
|
b12df0 |
- r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_ignore_inhibit, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
|
|
|
b12df0 |
- if (r < 0)
|
|
|
b12df0 |
- return r;
|
|
|
b12df0 |
- if (r == 0)
|
|
|
b12df0 |
- return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
|
b12df0 |
+ if (blocked) {
|
|
|
b12df0 |
+ /* We don't check polkit for root here, because you can't be more privileged than root */
|
|
|
b12df0 |
+ if (uid == 0 && (flags & SD_LOGIND_ROOT_CHECK_INHIBITORS))
|
|
|
b12df0 |
+ return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED,
|
|
|
b12df0 |
+ "Access denied to root due to active block inhibitor");
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ if (action_ignore_inhibit) {
|
|
|
b12df0 |
+ r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_ignore_inhibit, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
|
|
|
b12df0 |
+ if (r < 0)
|
|
|
b12df0 |
+ return r;
|
|
|
b12df0 |
+ if (r == 0)
|
|
|
b12df0 |
+ return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
|
b12df0 |
+ }
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
if (!multiple_sessions && !blocked && action) {
|
|
|
b12df0 |
@@ -1765,9 +1773,11 @@ static int method_do_shutdown_or_sleep(
|
|
|
b12df0 |
const char *action_multiple_sessions,
|
|
|
b12df0 |
const char *action_ignore_inhibit,
|
|
|
b12df0 |
const char *sleep_verb,
|
|
|
b12df0 |
+ bool with_flags,
|
|
|
b12df0 |
sd_bus_error *error) {
|
|
|
b12df0 |
|
|
|
b12df0 |
- int interactive, r;
|
|
|
b12df0 |
+ int interactive = false, r;
|
|
|
b12df0 |
+ uint64_t flags = 0;
|
|
|
b12df0 |
|
|
|
b12df0 |
assert(m);
|
|
|
b12df0 |
assert(message);
|
|
|
b12df0 |
@@ -1775,10 +1785,20 @@ static int method_do_shutdown_or_sleep(
|
|
|
b12df0 |
assert(w >= 0);
|
|
|
b12df0 |
assert(w <= _INHIBIT_WHAT_MAX);
|
|
|
b12df0 |
|
|
|
b12df0 |
- r = sd_bus_message_read(message, "b", &interactive);
|
|
|
b12df0 |
+ if (with_flags)
|
|
|
b12df0 |
+ r = sd_bus_message_read(message, "t", &flags);
|
|
|
b12df0 |
+ else
|
|
|
b12df0 |
+ r = sd_bus_message_read(message, "b", &interactive);
|
|
|
b12df0 |
+
|
|
|
b12df0 |
if (r < 0)
|
|
|
b12df0 |
return r;
|
|
|
b12df0 |
|
|
|
b12df0 |
+ if (with_flags && (flags & ~SD_LOGIND_SHUTDOWN_AND_SLEEP_FLAGS_PUBLIC))
|
|
|
b12df0 |
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
|
|
b12df0 |
+ "Invalid flags parameter");
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ SET_FLAG(flags, SD_LOGIND_INTERACTIVE, interactive);
|
|
|
b12df0 |
+
|
|
|
b12df0 |
/* Don't allow multiple jobs being executed at the same time */
|
|
|
b12df0 |
if (m->action_what)
|
|
|
b12df0 |
return sd_bus_error_setf(error, BUS_ERROR_OPERATION_IN_PROGRESS, "There's already a shutdown or sleep operation in progress");
|
|
|
b12df0 |
@@ -1795,8 +1815,8 @@ static int method_do_shutdown_or_sleep(
|
|
|
b12df0 |
return r;
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
- r = verify_shutdown_creds(m, message, w, interactive, action, action_multiple_sessions,
|
|
|
b12df0 |
- action_ignore_inhibit, error);
|
|
|
b12df0 |
+ r = verify_shutdown_creds(m, message, w, action, action_multiple_sessions,
|
|
|
b12df0 |
+ action_ignore_inhibit, flags, error);
|
|
|
b12df0 |
if (r != 0)
|
|
|
b12df0 |
return r;
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1818,6 +1838,7 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error
|
|
|
b12df0 |
"org.freedesktop.login1.power-off-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.power-off-ignore-inhibit",
|
|
|
b12df0 |
NULL,
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "PowerOffWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1832,6 +1853,7 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *
|
|
|
b12df0 |
"org.freedesktop.login1.reboot-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.reboot-ignore-inhibit",
|
|
|
b12df0 |
NULL,
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "RebootWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1846,6 +1868,7 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er
|
|
|
b12df0 |
"org.freedesktop.login1.halt-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.halt-ignore-inhibit",
|
|
|
b12df0 |
NULL,
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "HaltWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1860,6 +1883,7 @@ static int method_suspend(sd_bus_message *message, void *userdata, sd_bus_error
|
|
|
b12df0 |
"org.freedesktop.login1.suspend-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.suspend-ignore-inhibit",
|
|
|
b12df0 |
"suspend",
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "SuspendWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1874,6 +1898,7 @@ static int method_hibernate(sd_bus_message *message, void *userdata, sd_bus_erro
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-ignore-inhibit",
|
|
|
b12df0 |
"hibernate",
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "HibernateWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1888,6 +1913,7 @@ static int method_hybrid_sleep(sd_bus_message *message, void *userdata, sd_bus_e
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-ignore-inhibit",
|
|
|
b12df0 |
"hybrid-sleep",
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "HybridSleepWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -1902,6 +1928,7 @@ static int method_suspend_then_hibernate(sd_bus_message *message, void *userdata
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-multiple-sessions",
|
|
|
b12df0 |
"org.freedesktop.login1.hibernate-ignore-inhibit",
|
|
|
b12df0 |
"hybrid-sleep",
|
|
|
b12df0 |
+ sd_bus_message_is_method_call(message, NULL, "SuspendThenHibernateWithFlags"),
|
|
|
b12df0 |
error);
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -2089,8 +2116,8 @@ static int method_schedule_shutdown(sd_bus_message *message, void *userdata, sd_
|
|
|
b12df0 |
} else
|
|
|
b12df0 |
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unsupported shutdown type");
|
|
|
b12df0 |
|
|
|
b12df0 |
- r = verify_shutdown_creds(m, message, INHIBIT_SHUTDOWN, false,
|
|
|
b12df0 |
- action, action_multiple_sessions, action_ignore_inhibit, error);
|
|
|
b12df0 |
+ r = verify_shutdown_creds(m, message, INHIBIT_SHUTDOWN, action, action_multiple_sessions,
|
|
|
b12df0 |
+ action_ignore_inhibit, 0, error);
|
|
|
b12df0 |
if (r != 0)
|
|
|
b12df0 |
return r;
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -2683,60 +2710,395 @@ const sd_bus_vtable manager_vtable[] = {
|
|
|
b12df0 |
SD_BUS_PROPERTY("NCurrentSessions", "t", property_get_hashmap_size, offsetof(Manager, sessions), 0),
|
|
|
b12df0 |
SD_BUS_PROPERTY("UserTasksMax", "t", property_get_compat_user_tasks_max, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN),
|
|
|
b12df0 |
|
|
|
b12df0 |
- SD_BUS_METHOD("GetSession", "s", "o", method_get_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("GetSessionByPID", "u", "o", method_get_session_by_pid, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("GetUser", "u", "o", method_get_user, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("GetUserByPID", "u", "o", method_get_user_by_pid, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("GetSeat", "s", "o", method_get_seat, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ListSessions", NULL, "a(susso)", method_list_sessions, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ListUsers", NULL, "a(uso)", method_list_users, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ListSeats", NULL, "a(so)", method_list_seats, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ListInhibitors", NULL, "a(ssssuu)", method_list_inhibitors, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CreateSession", "uusssssussbssa(sv)", "soshusub", method_create_session, 0),
|
|
|
b12df0 |
- SD_BUS_METHOD("ReleaseSession", "s", NULL, method_release_session, 0),
|
|
|
b12df0 |
- SD_BUS_METHOD("ActivateSession", "s", NULL, method_activate_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ActivateSessionOnSeat", "ss", NULL, method_activate_session_on_seat, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("LockSession", "s", NULL, method_lock_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("UnlockSession", "s", NULL, method_lock_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("LockSessions", NULL, NULL, method_lock_sessions, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("UnlockSessions", NULL, NULL, method_lock_sessions, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("KillSession", "ssi", NULL, method_kill_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("KillUser", "ui", NULL, method_kill_user, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("TerminateSession", "s", NULL, method_terminate_session, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("TerminateUser", "u", NULL, method_terminate_user, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("TerminateSeat", "s", NULL, method_terminate_seat, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("SetUserLinger", "ubb", NULL, method_set_user_linger, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("AttachDevice", "ssb", NULL, method_attach_device, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("FlushDevices", "b", NULL, method_flush_devices, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("PowerOff", "b", NULL, method_poweroff, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("Reboot", "b", NULL, method_reboot, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("Halt", "b", NULL, method_halt, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("Suspend", "b", NULL, method_suspend, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("Hibernate", "b", NULL, method_hibernate, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("HybridSleep", "b", NULL, method_hybrid_sleep, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("SuspendThenHibernate", "b", NULL, method_suspend_then_hibernate, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanPowerOff", NULL, "s", method_can_poweroff, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanReboot", NULL, "s", method_can_reboot, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanHalt", NULL, "s", method_can_halt, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanSuspend", NULL, "s", method_can_suspend, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanHibernate", NULL, "s", method_can_hibernate, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanHybridSleep", NULL, "s", method_can_hybrid_sleep, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanSuspendThenHibernate", NULL, "s", method_can_suspend_then_hibernate, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("ScheduleShutdown", "st", NULL, method_schedule_shutdown, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CancelScheduledShutdown", NULL, "b", method_cancel_scheduled_shutdown, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("Inhibit", "ssss", "h", method_inhibit, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("CanRebootToFirmwareSetup", NULL, "s", method_can_reboot_to_firmware_setup, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("SetRebootToFirmwareSetup", "b", NULL, method_set_reboot_to_firmware_setup, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
- SD_BUS_METHOD("SetWallMessage", "sb", NULL, method_set_wall_message, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
-
|
|
|
b12df0 |
- SD_BUS_SIGNAL("SessionNew", "so", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("SessionRemoved", "so", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("UserNew", "uo", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("UserRemoved", "uo", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("SeatNew", "so", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("SeatRemoved", "so", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("PrepareForShutdown", "b", 0),
|
|
|
b12df0 |
- SD_BUS_SIGNAL("PrepareForSleep", "b", 0),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("GetSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ "o",
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ method_get_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("GetSessionByPID",
|
|
|
b12df0 |
+ "u",
|
|
|
b12df0 |
+ SD_BUS_PARAM(pid),
|
|
|
b12df0 |
+ "o",
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ method_get_session_by_pid,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("GetUser",
|
|
|
b12df0 |
+ "u",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid),
|
|
|
b12df0 |
+ "o",
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ method_get_user,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("GetUserByPID",
|
|
|
b12df0 |
+ "u",
|
|
|
b12df0 |
+ SD_BUS_PARAM(pid),
|
|
|
b12df0 |
+ "o",
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ method_get_user_by_pid,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("GetSeat",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id),
|
|
|
b12df0 |
+ "o",
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ method_get_seat,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ListSessions",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "a(susso)",
|
|
|
b12df0 |
+ SD_BUS_PARAM(sessions),
|
|
|
b12df0 |
+ method_list_sessions,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ListUsers",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "a(uso)",
|
|
|
b12df0 |
+ SD_BUS_PARAM(users),
|
|
|
b12df0 |
+ method_list_users,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ListSeats",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "a(so)",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seats),
|
|
|
b12df0 |
+ method_list_seats,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ListInhibitors",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "a(ssssuu)",
|
|
|
b12df0 |
+ SD_BUS_PARAM(inhibitors),
|
|
|
b12df0 |
+ method_list_inhibitors,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CreateSession",
|
|
|
b12df0 |
+ "uusssssussbssa(sv)",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(pid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(service)
|
|
|
b12df0 |
+ SD_BUS_PARAM(type)
|
|
|
b12df0 |
+ SD_BUS_PARAM(class)
|
|
|
b12df0 |
+ SD_BUS_PARAM(desktop)
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(vtnr)
|
|
|
b12df0 |
+ SD_BUS_PARAM(tty)
|
|
|
b12df0 |
+ SD_BUS_PARAM(display)
|
|
|
b12df0 |
+ SD_BUS_PARAM(remote)
|
|
|
b12df0 |
+ SD_BUS_PARAM(remote_user)
|
|
|
b12df0 |
+ SD_BUS_PARAM(remote_host)
|
|
|
b12df0 |
+ SD_BUS_PARAM(properties),
|
|
|
b12df0 |
+ "soshusub",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path)
|
|
|
b12df0 |
+ SD_BUS_PARAM(runtime_path)
|
|
|
b12df0 |
+ SD_BUS_PARAM(fifo_fd)
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(vtnr)
|
|
|
b12df0 |
+ SD_BUS_PARAM(existing),
|
|
|
b12df0 |
+ method_create_session,
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ReleaseSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_release_session,
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ActivateSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_activate_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ActivateSessionOnSeat",
|
|
|
b12df0 |
+ "ss",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_activate_session_on_seat,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("LockSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_lock_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("UnlockSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_lock_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD("LockSessions",
|
|
|
b12df0 |
+ NULL,
|
|
|
b12df0 |
+ NULL,
|
|
|
b12df0 |
+ method_lock_sessions,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD("UnlockSessions",
|
|
|
b12df0 |
+ NULL,
|
|
|
b12df0 |
+ NULL,
|
|
|
b12df0 |
+ method_lock_sessions,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("KillSession",
|
|
|
b12df0 |
+ "ssi",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(who)
|
|
|
b12df0 |
+ SD_BUS_PARAM(signal_number),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_kill_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("KillUser",
|
|
|
b12df0 |
+ "ui",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(signal_number),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_kill_user,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("TerminateSession",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_terminate_session,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("TerminateUser",
|
|
|
b12df0 |
+ "u",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_terminate_user,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("TerminateSeat",
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_terminate_seat,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SetUserLinger",
|
|
|
b12df0 |
+ "ubb",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(enable)
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_set_user_linger,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("AttachDevice",
|
|
|
b12df0 |
+ "ssb",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(sysfs_path)
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_attach_device,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("FlushDevices",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_flush_devices,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("PowerOff",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_poweroff,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("PowerOffWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_poweroff,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("Reboot",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_reboot,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("RebootWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_reboot,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("Halt",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_halt,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("HaltWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_halt,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("Suspend",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_suspend,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SuspendWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_suspend,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("Hibernate",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("HibernateWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("HybridSleep",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_hybrid_sleep,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("HybridSleepWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_hybrid_sleep,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SuspendThenHibernate",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(interactive),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_suspend_then_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SuspendThenHibernateWithFlags",
|
|
|
b12df0 |
+ "t",
|
|
|
b12df0 |
+ SD_BUS_PARAM(flags),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_suspend_then_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanPowerOff",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_poweroff,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanReboot",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_reboot,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanHalt",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_halt,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanSuspend",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_suspend,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanHibernate",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanHybridSleep",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_hybrid_sleep,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanSuspendThenHibernate",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_suspend_then_hibernate,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("ScheduleShutdown",
|
|
|
b12df0 |
+ "st",
|
|
|
b12df0 |
+ SD_BUS_PARAM(type)
|
|
|
b12df0 |
+ SD_BUS_PARAM(usec),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_schedule_shutdown,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CancelScheduledShutdown",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(cancelled),
|
|
|
b12df0 |
+ method_cancel_scheduled_shutdown,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("Inhibit",
|
|
|
b12df0 |
+ "ssss",
|
|
|
b12df0 |
+ SD_BUS_PARAM(what)
|
|
|
b12df0 |
+ SD_BUS_PARAM(who)
|
|
|
b12df0 |
+ SD_BUS_PARAM(why)
|
|
|
b12df0 |
+ SD_BUS_PARAM(mode),
|
|
|
b12df0 |
+ "h",
|
|
|
b12df0 |
+ SD_BUS_PARAM(pipe_fd),
|
|
|
b12df0 |
+ method_inhibit,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("CanRebootToFirmwareSetup",
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ "s",
|
|
|
b12df0 |
+ SD_BUS_PARAM(result),
|
|
|
b12df0 |
+ method_can_reboot_to_firmware_setup,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SetRebootToFirmwareSetup",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(enable),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_set_reboot_to_firmware_setup,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES("SetWallMessage",
|
|
|
b12df0 |
+ "sb",
|
|
|
b12df0 |
+ SD_BUS_PARAM(wall_message)
|
|
|
b12df0 |
+ SD_BUS_PARAM(enable),
|
|
|
b12df0 |
+ NULL,,
|
|
|
b12df0 |
+ method_set_wall_message,
|
|
|
b12df0 |
+ SD_BUS_VTABLE_UNPRIVILEGED),
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("SessionNew",
|
|
|
b12df0 |
+ "so",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("SessionRemoved",
|
|
|
b12df0 |
+ "so",
|
|
|
b12df0 |
+ SD_BUS_PARAM(session_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("UserNew",
|
|
|
b12df0 |
+ "uo",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("UserRemoved",
|
|
|
b12df0 |
+ "uo",
|
|
|
b12df0 |
+ SD_BUS_PARAM(uid)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("SeatNew",
|
|
|
b12df0 |
+ "so",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("SeatRemoved",
|
|
|
b12df0 |
+ "so",
|
|
|
b12df0 |
+ SD_BUS_PARAM(seat_id)
|
|
|
b12df0 |
+ SD_BUS_PARAM(object_path),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("PrepareForShutdown",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(start),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES("PrepareForSleep",
|
|
|
b12df0 |
+ "b",
|
|
|
b12df0 |
+ SD_BUS_PARAM(start),
|
|
|
b12df0 |
+ 0),
|
|
|
b12df0 |
|
|
|
b12df0 |
SD_BUS_VTABLE_END
|
|
|
b12df0 |
};
|
|
|
b12df0 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
b12df0 |
index 8bcbf6bf4b..3dd7c1522f 100644
|
|
|
b12df0 |
--- a/src/systemctl/systemctl.c
|
|
|
b12df0 |
+++ b/src/systemctl/systemctl.c
|
|
|
b12df0 |
@@ -50,6 +50,7 @@
|
|
|
b12df0 |
#include "list.h"
|
|
|
b12df0 |
#include "locale-util.h"
|
|
|
b12df0 |
#include "log.h"
|
|
|
b12df0 |
+#include "login-util.h"
|
|
|
b12df0 |
#include "logs-show.h"
|
|
|
b12df0 |
#include "macro.h"
|
|
|
b12df0 |
#include "mkdir.h"
|
|
|
b12df0 |
@@ -3266,6 +3267,8 @@ static int logind_reboot(enum action a) {
|
|
|
b12df0 |
};
|
|
|
b12df0 |
|
|
|
b12df0 |
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
|
|
b12df0 |
+ const char *method_with_flags;
|
|
|
b12df0 |
+ uint64_t flags = 0;
|
|
|
b12df0 |
sd_bus *bus;
|
|
|
b12df0 |
int r;
|
|
|
b12df0 |
|
|
|
b12df0 |
@@ -3284,6 +3287,29 @@ static int logind_reboot(enum action a) {
|
|
|
b12df0 |
if (arg_dry_run)
|
|
|
b12df0 |
return 0;
|
|
|
b12df0 |
|
|
|
b12df0 |
+ SET_FLAG(flags, SD_LOGIND_ROOT_CHECK_INHIBITORS, arg_check_inhibitors > 0);
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ method_with_flags = strjoina(actions[a].method, "WithFlags");
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ r = sd_bus_call_method(
|
|
|
b12df0 |
+ bus,
|
|
|
b12df0 |
+ "org.freedesktop.login1",
|
|
|
b12df0 |
+ "/org/freedesktop/login1",
|
|
|
b12df0 |
+ "org.freedesktop.login1.Manager",
|
|
|
b12df0 |
+ method_with_flags,
|
|
|
b12df0 |
+ &error,
|
|
|
b12df0 |
+ NULL,
|
|
|
b12df0 |
+ "t", flags);
|
|
|
b12df0 |
+ if (r >= 0)
|
|
|
b12df0 |
+ return 0;
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ if (!sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_METHOD))
|
|
|
b12df0 |
+ return log_error_errno(r, "Failed to %s via logind: %s", actions[a].description, bus_error_message(&error, r));
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+ /* Fallback to original methods in case there is older version of systemd-logind */
|
|
|
b12df0 |
+ log_debug("Method %s not available: %s. Falling back to %s", method_with_flags, bus_error_message(&error, r), actions[a].method);
|
|
|
b12df0 |
+ sd_bus_error_free(&error);
|
|
|
b12df0 |
+
|
|
|
b12df0 |
r = sd_bus_call_method(
|
|
|
b12df0 |
bus,
|
|
|
b12df0 |
"org.freedesktop.login1",
|
|
|
b12df0 |
diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h
|
|
|
b12df0 |
index 1268085498..8805e19477 100644
|
|
|
b12df0 |
--- a/src/systemd/sd-bus-vtable.h
|
|
|
b12df0 |
+++ b/src/systemd/sd-bus-vtable.h
|
|
|
b12df0 |
@@ -65,10 +65,12 @@ struct sd_bus_vtable {
|
|
|
b12df0 |
const char *result;
|
|
|
b12df0 |
sd_bus_message_handler_t handler;
|
|
|
b12df0 |
size_t offset;
|
|
|
b12df0 |
+ const char *names;
|
|
|
b12df0 |
} method;
|
|
|
b12df0 |
struct {
|
|
|
b12df0 |
const char *member;
|
|
|
b12df0 |
const char *signature;
|
|
|
b12df0 |
+ const char *names;
|
|
|
b12df0 |
} signal;
|
|
|
b12df0 |
struct {
|
|
|
b12df0 |
const char *member;
|
|
|
b12df0 |
@@ -91,7 +93,10 @@ struct sd_bus_vtable {
|
|
|
b12df0 |
}, \
|
|
|
b12df0 |
}
|
|
|
b12df0 |
|
|
|
b12df0 |
-#define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags) \
|
|
|
b12df0 |
+/* helper macro to format method and signal parameters, one at a time */
|
|
|
b12df0 |
+#define SD_BUS_PARAM(x) #x "\0"
|
|
|
b12df0 |
+
|
|
|
b12df0 |
+#define SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, _in_names, _result, _out_names, _handler, _offset, _flags) \
|
|
|
b12df0 |
{ \
|
|
|
b12df0 |
.type = _SD_BUS_VTABLE_METHOD, \
|
|
|
b12df0 |
.flags = _flags, \
|
|
|
b12df0 |
@@ -102,13 +107,18 @@ struct sd_bus_vtable {
|
|
|
b12df0 |
.result = _result, \
|
|
|
b12df0 |
.handler = _handler, \
|
|
|
b12df0 |
.offset = _offset, \
|
|
|
b12df0 |
+ .names = _in_names _out_names, \
|
|
|
b12df0 |
}, \
|
|
|
b12df0 |
}, \
|
|
|
b12df0 |
}
|
|
|
b12df0 |
+#define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags) \
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, "", _result, "", _handler, _offset, _flags)
|
|
|
b12df0 |
+#define SD_BUS_METHOD_WITH_NAMES(_member, _signature, _in_names, _result, _out_names, _handler, _flags) \
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, _in_names, _result, _out_names, _handler, 0, _flags)
|
|
|
b12df0 |
#define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags) \
|
|
|
b12df0 |
- SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, 0, _flags)
|
|
|
b12df0 |
+ SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, "", _result, "", _handler, 0, _flags)
|
|
|
b12df0 |
|
|
|
b12df0 |
-#define SD_BUS_SIGNAL(_member, _signature, _flags) \
|
|
|
b12df0 |
+#define SD_BUS_SIGNAL_WITH_NAMES(_member, _signature, _out_names, _flags) \
|
|
|
b12df0 |
{ \
|
|
|
b12df0 |
.type = _SD_BUS_VTABLE_SIGNAL, \
|
|
|
b12df0 |
.flags = _flags, \
|
|
|
b12df0 |
@@ -116,9 +126,12 @@ struct sd_bus_vtable {
|
|
|
b12df0 |
.signal = { \
|
|
|
b12df0 |
.member = _member, \
|
|
|
b12df0 |
.signature = _signature, \
|
|
|
b12df0 |
+ .names = _out_names, \
|
|
|
b12df0 |
}, \
|
|
|
b12df0 |
}, \
|
|
|
b12df0 |
}
|
|
|
b12df0 |
+#define SD_BUS_SIGNAL(_member, _signature, _flags) \
|
|
|
b12df0 |
+ SD_BUS_SIGNAL_WITH_NAMES(_member, _signature, "", _flags)
|
|
|
b12df0 |
|
|
|
b12df0 |
#define SD_BUS_PROPERTY(_member, _signature, _get, _offset, _flags) \
|
|
|
b12df0 |
{ \
|