logind: add UnlockSessions() clal to complement LockSessions()
This commit is contained in:
parent
ee17c9281d
commit
b61600291e
|
@ -251,10 +251,12 @@
|
|||
|
||||
<varlistentry>
|
||||
<term><command>lock-sessions</command></term>
|
||||
<term><command>unlock-sessions</command></term>
|
||||
|
||||
<listitem><para>Activate the screen
|
||||
lock on all current sessions
|
||||
supporting it.</para></listitem>
|
||||
<listitem><para>Activates/deactivates
|
||||
the screen lock on all current
|
||||
sessions supporting
|
||||
it.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
|
|
@ -1287,6 +1287,8 @@ static int flush_devices(DBusConnection *bus, char **args, unsigned n) {
|
|||
}
|
||||
|
||||
static int lock_sessions(DBusConnection *bus, char **args, unsigned n) {
|
||||
assert(args);
|
||||
|
||||
polkit_agent_open_if_enabled();
|
||||
|
||||
return bus_method_call_with_reply (
|
||||
|
@ -1294,7 +1296,7 @@ static int lock_sessions(DBusConnection *bus, char **args, unsigned n) {
|
|||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"LockSessions",
|
||||
streq(args[0], "lock-sessions") ? "LockSessions" : "UnlockSessions",
|
||||
NULL,
|
||||
NULL,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
@ -1348,6 +1350,7 @@ static int help(void) {
|
|||
" lock-session [ID...] Screen lock one or more sessions\n"
|
||||
" unlock-session [ID...] Screen unlock one or more sessions\n"
|
||||
" lock-sessions Screen lock all current sessions\n"
|
||||
" unlock-sessions Screen unlock all current sessions\n"
|
||||
" terminate-session [ID...] Terminate one or more sessions\n"
|
||||
" kill-session [ID...] Send signal to processes of a session\n"
|
||||
" list-users List users\n"
|
||||
|
@ -1496,6 +1499,7 @@ static int loginctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
|
|||
{ "lock-session", MORE, 2, activate },
|
||||
{ "unlock-session", MORE, 2, activate },
|
||||
{ "lock-sessions", EQUAL, 1, lock_sessions },
|
||||
{ "unlock-sessions", EQUAL, 1, lock_sessions },
|
||||
{ "terminate-session", MORE, 2, activate },
|
||||
{ "kill-session", MORE, 2, kill_session },
|
||||
{ "list-users", EQUAL, 1, list_users },
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
|
||||
" </method>\n" \
|
||||
" <method name=\"LockSessions\"/>\n" \
|
||||
" <method name=\"UnlockSessions\"/>\n" \
|
||||
" <method name=\"KillSession\">\n" \
|
||||
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
|
||||
" <arg name=\"who\" type=\"s\" direction=\"in\"/>\n" \
|
||||
|
@ -1853,8 +1854,10 @@ static DBusHandlerResult manager_message_handler(
|
|||
if (!reply)
|
||||
goto oom;
|
||||
|
||||
} else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "LockSessions")) {
|
||||
r = session_send_lock_all(m, true);
|
||||
} else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "LockSessions") ||
|
||||
dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "UnlockSessions")) {
|
||||
|
||||
r = session_send_lock_all(m, streq(dbus_message_get_member(message), "LockSessions"));
|
||||
if (r < 0)
|
||||
bus_send_error_reply(connection, message, NULL, r);
|
||||
|
||||
|
|
Loading…
Reference in a new issue