1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00

logind: introduce ActivateSessionOnSeat()

This commit is contained in:
Lennart Poettering 2012-02-07 20:12:13 +01:00
parent acdfc041cc
commit 84c3361e12
2 changed files with 43 additions and 0 deletions

View File

@ -82,6 +82,10 @@
" <method name=\"ActivateSession\">\n" \
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
" </method>\n" \
" <method name=\"ActivateSessionOnSeat\">\n" \
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
" <arg name=\"seat\" type=\"s\" direction=\"in\"/>\n" \
" </method>\n" \
" <method name=\"LockSession\">\n" \
" <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
" </method>\n" \
@ -1043,6 +1047,41 @@ static DBusHandlerResult manager_message_handler(
if (!reply)
goto oom;
} else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ActivateSessionOnSeat")) {
const char *session_name, *seat_name;
Session *session;
Seat *seat;
/* Same as ActivateSession() but refuses to work if
* the seat doesn't match */
if (!dbus_message_get_args(
message,
&error,
DBUS_TYPE_STRING, &session_name,
DBUS_TYPE_STRING, &seat_name,
DBUS_TYPE_INVALID))
return bus_send_error_reply(connection, message, &error, -EINVAL);
session = hashmap_get(m->sessions, session_name);
if (!session)
return bus_send_error_reply(connection, message, &error, -ENOENT);
seat = hashmap_get(m->seats, seat_name);
if (!seat)
return bus_send_error_reply(connection, message, &error, -ENOENT);
if (session->seat != seat)
return bus_send_error_reply(connection, message, &error, -EINVAL);
r = session_activate(session);
if (r < 0)
return bus_send_error_reply(connection, message, NULL, r);
reply = dbus_message_new_method_return(message);
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;

View File

@ -72,6 +72,10 @@
send_interface="org.freedesktop.login1.Manager"
send_member="ActivateSession"/>
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Manager"
send_member="ActivateSessionOnSeat"/>
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Seat"
send_member="ActivateSession"/>