diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-01-24 05:29:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-01-24 05:29:37 +0100 |
commit | b61600291e3bbc51482bbb9823ccd48f03c130da (patch) | |
tree | c969553d781619f4809a2de98d7198a2c3dcf0fe /src/login | |
parent | ee17c9281d3c208ca3f4fadd800990e61e8fd4f2 (diff) |
logind: add UnlockSessions() clal to complement LockSessions()
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/loginctl.c | 6 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 7 |
2 files changed, 10 insertions, 3 deletions
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); |