summaryrefslogtreecommitdiff
path: root/src/logind-user-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-13 19:58:35 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-13 19:59:28 +0200
commitde07ab16c6b919cead26c9a5209a362127ff6142 (patch)
tree9b4d4f674ae5fa607fb8516be541d16dcca9e9c8 /src/logind-user-dbus.c
parenta17204af0e950be7a5199db62ef400814e29aa3c (diff)
loginctl: implement missing kill verb
Diffstat (limited to 'src/logind-user-dbus.c')
-rw-r--r--src/logind-user-dbus.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/logind-user-dbus.c b/src/logind-user-dbus.c
index 7263d1b757..3673a28bd4 100644
--- a/src/logind-user-dbus.c
+++ b/src/logind-user-dbus.c
@@ -29,6 +29,9 @@
#define BUS_USER_INTERFACE \
" <interface name=\"org.freedesktop.login1.User\">\n" \
" <method name=\"Terminate\"/>\n" \
+ " <method name=\"Kill\">\n" \
+ " <arg name=\"signal\" type=\"s\"/>\n" \
+ " </method>\n" \
" <property name=\"UID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"GID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"Name\" type=\"s\" access=\"read\"/>\n" \
@@ -250,6 +253,27 @@ static DBusHandlerResult user_message_dispatch(
reply = dbus_message_new_method_return(message);
if (!reply)
goto oom;
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.User", "Kill")) {
+ int32_t signo;
+
+ if (!dbus_message_get_args(
+ message,
+ &error,
+ DBUS_TYPE_INT32, &signo,
+ DBUS_TYPE_INVALID))
+ return bus_send_error_reply(connection, message, &error, -EINVAL);
+
+ if (signo <= 0 || signo >= _NSIG)
+ return bus_send_error_reply(connection, message, &error, -EINVAL);
+
+ r = user_kill(u, signo);
+ if (r < 0)
+ return bus_send_error_reply(connection, message, NULL, r);
+
+ reply = dbus_message_new_method_return(message);
+ if (!reply)
+ goto oom;
+
} else
return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, properties);