summaryrefslogtreecommitdiff
path: root/src/logind-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-09 02:58:05 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-13 19:59:28 +0200
commit88e3dc903bd543a74b8699c1575b0da9eeab24a2 (patch)
treea2a1995d00afef84d404b5a0fe2e233d202b96c1 /src/logind-dbus.c
parentd4b36d99f1b3821243d3f122128623dd2653b1cf (diff)
loginctl: implement more verbs
Diffstat (limited to 'src/logind-dbus.c')
-rw-r--r--src/logind-dbus.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/logind-dbus.c b/src/logind-dbus.c
index a2a442ee27..ec39d56d9e 100644
--- a/src/logind-dbus.c
+++ b/src/logind-dbus.c
@@ -75,6 +75,12 @@
" <method name=\"ActivateSession\">\n" \
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
" </method>\n" \
+ " <method name=\"LockSession\">\n" \
+ " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
+ " </method>\n" \
+ " <method name=\"UnlockSession\">\n" \
+ " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
+ " </method>\n" \
" <method name=\"TerminateSession\">\n" \
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
" </method>\n" \
@@ -980,6 +986,29 @@ static DBusHandlerResult manager_message_handler(
if (!reply)
goto oom;
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "LockSession") ||
+ dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "UnlockSession")) {
+ const char *name;
+ Session *session;
+
+ if (!dbus_message_get_args(
+ message,
+ &error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+ return bus_send_error_reply(connection, message, &error, -EINVAL);
+
+ session = hashmap_get(m->sessions, name);
+ if (!session)
+ return bus_send_error_reply(connection, message, &error, -ENOENT);
+
+ if (session_send_lock(session, streq(dbus_message_get_member(message), "LockSession")) < 0)
+ goto oom;
+
+ reply = dbus_message_new_method_return(message);
+ if (!reply)
+ goto oom;
+
} else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "TerminateSession")) {
const char *name;
Session *session;