diff options
-rw-r--r-- | man/loginctl.xml | 8 | ||||
-rw-r--r-- | src/login/loginctl.c | 6 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/man/loginctl.xml b/man/loginctl.xml index 8a20d18cfa..9d082cf915 100644 --- a/man/loginctl.xml +++ b/man/loginctl.xml @@ -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> diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 0e57e0828e..473c77b92d 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -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 }, diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 1717584e8e..0960aab634 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -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); |