logind-dbus.c revision d1122ad5e3222cc17bfb556c23273598a5fb60fa
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen This file is part of systemd.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Copyright 2011 Lennart Poettering
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is free software; you can redistribute it and/or modify it
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen under the terms of the GNU Lesser General Public License as published by
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen (at your option) any later version.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is distributed in the hope that it will be useful, but
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Lesser General Public License for more details.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen You should have received a copy of the GNU Lesser General Public License
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <interface name=\"org.freedesktop.login1.Manager\">\n" \
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering " <method name=\"GetSession\">\n" \
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering " <arg name=\"session\" type=\"o\" direction=\"out\"/>\n" \
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering " </method>\n" \
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering " <method name=\"GetSessionByPID\">\n" \
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering " <arg name=\"pid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"session\" type=\"o\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"GetUser\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"user\" type=\"o\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"GetSeat\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"seat\" type=\"o\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ListSessions\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"sessions\" type=\"a(susso)\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ListUsers\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"users\" type=\"a(uso)\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ListSeats\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"seats\" type=\"a(so)\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"CreateSession\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"leader\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"sevice\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"type\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"class\" type=\"s\" direction=\"in\"/>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"seat\" type=\"s\" direction=\"in\"/>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"vtnr\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"tty\" type=\"s\" direction=\"in\"/>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"display\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"remote\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"remote_user\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"remote_host\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"controllers\" type=\"as\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"reset_controllers\" type=\"as\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"kill_processes\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"runtime_path\" type=\"o\" direction=\"out\"/>\n" \
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poettering " <arg name=\"fd\" type=\"h\" direction=\"out\"/>\n" \
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poettering " <arg name=\"seat\" type=\"s\" direction=\"out\"/>\n" \
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poettering " <arg name=\"vtnr\" type=\"u\" direction=\"out\"/>\n" \
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poettering " </method>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <method name=\"ReleaseSession\">\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ActivateSession\">\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ActivateSessionOnSeat\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering " <arg name=\"seat\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"LockSession\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"UnlockSession\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"KillSession\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"who\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"signal\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"KillUser\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"signal\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"TerminateSession\">\n" \
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"TerminateUser\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"TerminateSeat\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"SetUserLinger\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"b\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"interactive\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"AttachDevice\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"seat\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"sysfs\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"interactive\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"FlushDevices\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"interactive\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"PowerOff\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"interactive\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"Reboot\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"interactive\" type=\"b\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"CanPowerOff\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"result\" type=\"s\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"CanReboot\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"result\" type=\"s\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"Inhibit\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"what\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"who\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"why\" type=\"s\" direction=\"in\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"fd\" type=\"h\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <method name=\"ListInhibitors\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"inhibitors\" type=\"a(sssuu)\" direction=\"out\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </method>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"SessionNew\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"SessionRemoved\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"UserNew\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"UserRemoved\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"uid\" type=\"u\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"SeatNew\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <signal name=\"SeatRemoved\">\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"id\" type=\"s\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <arg name=\"path\" type=\"o\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </signal>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"ControlGroupHierarchy\" type=\"s\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"Controllers\" type=\"as\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"ResetControllers\" type=\"as\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"NAutoVTs\" type=\"u\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"KillOnlyUsers\" type=\"as\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"KillExcludeUsers\" type=\"as\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"KillUserProcesses\" type=\"b\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"IdleHint\" type=\"b\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"IdleSinceHint\" type=\"t\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"IdleSinceHintMonotonic\" type=\"t\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " <property name=\"Inhibited\" type=\"s\" access=\"read\"/>\n" \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering " </interface>\n"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering "org.freedesktop.login1.Manager\0"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int bus_manager_append_idle_hint(DBusMessageIter *i, const char *property, void *data) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(i, DBUS_TYPE_BOOLEAN, &b))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int bus_manager_append_idle_hint_since(DBusMessageIter *i, const char *property, void *data) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering u = streq(property, "IdleSinceHint") ? t.realtime : t.monotonic;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT64, &u))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int bus_manager_append_inhibited(DBusMessageIter *i, const char *property, void *data) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *p;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &p))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMessage **_reply) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *type, *class, *seat, *tty, *display, *remote_user, *remote_host, *service;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char **controllers = NULL, **reset_controllers = NULL;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_init(message, &iter) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_basic(&iter, &uid);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_basic(&iter, &leader);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_basic(&iter, &service);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_basic(&iter, &type);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_basic(&iter, &class);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &seat);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &vtnr);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &tty);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering else if (s != m->vtconsole)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering return v < 0 ? v : -EINVAL;
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering else if (s != m->vtconsole)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering } else if (!isempty(tty) && s && seat_is_vtconsole(s))
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &display);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &remote);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_basic(&iter, &remote_user);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_basic(&iter, &remote_host);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_STRING)
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering r = bus_parse_strv_iter(&iter, &controllers);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering if (strv_contains(controllers, "systemd") ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_STRING) {
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering r = bus_parse_strv_iter(&iter, &reset_controllers);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering if (strv_contains(reset_controllers, "systemd") ||
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN) {
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering dbus_message_iter_get_basic(&iter, &kill_processes);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering r = manager_add_user_by_uid(m, uid, &user);
90ab504273a7f186ebb76e6acfb778b4e0d7c91bLennart Poettering audit_session_from_pid(leader, &audit_id);
90ab504273a7f186ebb76e6acfb778b4e0d7c91bLennart Poettering asprintf(&id, "%lu", (unsigned long) audit_id);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering /* Session already exists, client is probably
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering * something like "su" which changes uid but
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering * is still the same audit session */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering reply = dbus_message_new_method_return(message);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering seat = session->seat ? session->seat->id : "";
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen DBUS_TYPE_STRING, &session->user->runtime_path,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (asprintf(&id, "c%lu", ++m->session_counter) < 0) {
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen r = manager_add_session(m, user, id, &session);
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering session->reset_controllers = reset_controllers;
edc501d4674dadc304d45a7e1c5b69e207eb8cd4Lennart Poettering session->kill_processes = kill_processes;
f0e1546763304aedc90e91d70dab9eeb7c966cf8Lennart Poettering session->remote_user = strdup(remote_user);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering session->remote_host = strdup(remote_host);
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering reply = dbus_message_new_method_return(message);
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering DBUS_TYPE_STRING, &session->user->runtime_path,
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poetteringstatic int bus_manager_inhibit(Manager *m, DBusConnection *connection, DBusMessage *message, DBusError *error, DBusMessage **_reply) {
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering unsigned long ul;
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering r = verify_polkit(connection, message, "org.freedesktop.login1.inhibit", false, NULL, error);
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering ul = dbus_bus_get_unix_user(connection, dbus_message_get_sender(message), error);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering pid = bus_get_unix_process_id(connection, dbus_message_get_sender(message), error);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen if (asprintf(&id, "%lu", ++m->inhibit_counter) < 0) {
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering } while (hashmap_get(m->inhibitors, id));
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen reply = dbus_message_new_method_return(message);
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poetteringstatic int trigger_device(Manager *m, struct udev_device *d) {
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering if (udev_enumerate_add_match_parent(e, d) < 0) {
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering const char *p;
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poetteringstatic int attach_device(Manager *m, const char *seat, const char *sysfs) {
bda2c408f8a739c19161818bcc842107f60652a2Tom Gundersen d = udev_device_new_from_syspath(m->udev, sysfs);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering id_for_seat = udev_device_get_property_value(d, "ID_FOR_SEAT");
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", id_for_seat) < 0) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (asprintf(&rule, "TAG==\"seat\", ENV{ID_FOR_SEAT}==\"%s\", ENV{ID_SEAT}=\"%s\"", id_for_seat, seat) < 0) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = write_one_line_file_atomic(file, rule);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering log_warning("Failed to open /etc/udev/rules.d: %m");
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (unlinkat(dirfd(d), de->d_name, 0) < 0)
ad867662936a4c7ab2c7116d804c272338801231Lennart Poettering log_warning("Failed to unlink %s: %m", de->d_name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering /* Hmm, there's only one session, but let's make sure it
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering * actually belongs to the user who is asking. If not, better
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * be safe than sorry. */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering unsigned long ul;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering ul = dbus_bus_get_unix_user(connection, dbus_message_get_sender(message), error);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringstatic const BusProperty bus_login_manager_properties[] = {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "ControlGroupHierarchy", bus_property_append_string, "s", offsetof(Manager, cgroup_path), true },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "Controllers", bus_property_append_strv, "as", offsetof(Manager, controllers), true },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "ResetControllers", bus_property_append_strv, "as", offsetof(Manager, reset_controllers), true },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "NAutoVTs", bus_property_append_unsigned, "u", offsetof(Manager, n_autovts) },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "KillOnlyUsers", bus_property_append_strv, "as", offsetof(Manager, kill_only_users), true },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "KillExcludeUsers", bus_property_append_strv, "as", offsetof(Manager, kill_exclude_users), true },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "KillUserProcesses", bus_property_append_bool, "b", offsetof(Manager, kill_user_processes) },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "IdleHint", bus_manager_append_idle_hint, "b", 0 },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "IdleSinceHint", bus_manager_append_idle_hint_since, "t", 0 },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "IdleSinceHintMonotonic", bus_manager_append_idle_hint_since, "t", 0 },
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering { "Inhibited", bus_manager_append_inhibited, "s", 0 },
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenstatic DBusHandlerResult manager_message_handler(
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "GetSession")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering session = hashmap_get(m->sessions, name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering reply = dbus_message_new_method_return(message);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "GetSessionByPID")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen r = manager_get_session_by_pid(m, pid, &session);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, NULL, r < 0 ? r : -ENOENT);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen reply = dbus_message_new_method_return(message);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "GetUser")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "GetSeat")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ListSessions")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_init_append(reply, &iter);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(susso)", &sub))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering HASHMAP_FOREACH(session, m->sessions, i) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &session->id) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &uid) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &session->user->name) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, session->seat ? (const char**) &session->seat->id : &empty) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &p)) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering if (!dbus_message_iter_close_container(&sub, &sub2))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_close_container(&iter, &sub))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ListUsers")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering dbus_message_iter_init_append(reply, &iter);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(uso)", &sub))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &uid) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &user->name) ||
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &p)) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_close_container(&sub, &sub2))
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering if (!dbus_message_iter_close_container(&iter, &sub))
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ListSeats")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering dbus_message_iter_init_append(reply, &iter);
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(so)", &sub))
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &seat->id) ||
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &p)) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_close_container(&sub, &sub2))
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_close_container(&iter, &sub))
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ListInhibitors")) {
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering reply = dbus_message_new_method_return(message);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering dbus_message_iter_init_append(reply, &iter);
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(sssuu)", &sub))
5cb36f41f01cf4b1f4395abfffd1b33116591e58Lennart Poettering HASHMAP_FOREACH(inhibitor, m->inhibitors, i) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2))
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering what = inhibit_what_to_string(inhibitor->what);
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &what) ||
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &who) ||
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &why) ||
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &uid) ||
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &pid))
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering if (!dbus_message_iter_close_container(&sub, &sub2))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (!dbus_message_iter_close_container(&iter, &sub))
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "Inhibit")) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering r = bus_manager_inhibit(m, connection, message, &error, &reply);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return bus_send_error_reply(connection, message, &error, r);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "CreateSession")) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = bus_manager_create_session(m, message, &reply);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Don't delay the work on OOM here, since it might be
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering * triggered by a low RLIMIT_NOFILE here (since we
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering * send a dupped fd to the client), and we'd rather
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering * see this fail quickly then be retried later */
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering return bus_send_error_reply(connection, message, NULL, r);
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ReleaseSession")) {
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering session = hashmap_get(m->sessions, name);
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering /* We use the FIFO to detect stray sessions where the
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering process invoking PAM dies abnormally. We need to make
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering sure that that process is not killed if at the clean
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering end of the session it closes the FIFO. Hence, with
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering this call explicitly turn off the FIFO logic, so that
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering the PAM code can finish clean up on its own */
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ActivateSession")) {
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering session = hashmap_get(m->sessions, name);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering return bus_send_error_reply(connection, message, NULL, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering reply = dbus_message_new_method_return(message);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "ActivateSessionOnSeat")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering /* Same as ActivateSession() but refuses to work if
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * the seat doesn't match */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering session = hashmap_get(m->sessions, session_name);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
bf3f1271e2cc0c22b11c8a805a997578dabe9191Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, NULL, r);
bf3f1271e2cc0c22b11c8a805a997578dabe9191Lennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "LockSession") ||
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "UnlockSession")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering session = hashmap_get(m->sessions, name);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering if (session_send_lock(session, streq(dbus_message_get_member(message), "LockSession")) < 0)
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "KillSession")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering session = hashmap_get(m->sessions, name);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, NULL, r);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "KillUser")) {
bf3f1271e2cc0c22b11c8a805a997578dabe9191Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, NULL, r);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "TerminateSession")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering session = hashmap_get(m->sessions, name);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, NULL, r);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering reply = dbus_message_new_method_return(message);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "TerminateUser")) {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering return bus_send_error_reply(connection, message, NULL, r);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering reply = dbus_message_new_method_return(message);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "TerminateSeat")) {
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering return bus_send_error_reply(connection, message, &error, -ENOENT);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering reply = dbus_message_new_method_return(message);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "SetUserLinger")) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, errno ? -errno : -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, "org.freedesktop.login1.set-user-linger", interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = safe_mkdir("/var/lib/systemd/linger", 0755, 0, 0);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering path = strappend("/var/lib/systemd/linger/", pw->pw_name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering if (manager_add_user_by_uid(m, uid, &u) >= 0)
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, -errno);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering reply = dbus_message_new_method_return(message);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "AttachDevice")) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering if (!path_startswith(sysfs, "/sys") || !seat_name_is_valid(seat))
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, "org.freedesktop.login1.attach-device", interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering reply = dbus_message_new_method_return(message);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "FlushDevices")) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, "org.freedesktop.login1.flush-devices", interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering reply = dbus_message_new_method_return(message);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "PowerOff") ||
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "Reboot")) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, -EINVAL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = have_multiple_sessions(connection, m, message, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering inhibit = manager_is_inhibited(m, INHIBIT_SHUTDOWN, NULL);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering action = streq(dbus_message_get_member(message), "PowerOff") ?
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.power-off-multiple-sessions" :
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.reboot-multiple-sessions";
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, action, interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering action = streq(dbus_message_get_member(message), "PowerOff") ?
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.power-off-ignore-inhibit" :
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.reboot-ignore-inhibit";
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, action, interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering action = streq(dbus_message_get_member(message), "PowerOff") ?
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.power-off" :
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.login1.reboot";
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering r = verify_polkit(connection, message, action, interactive, NULL, &error);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "org.freedesktop.systemd1.Manager",
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering return bus_send_error_reply(connection, message, NULL, -ENOMEM);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering name = streq(dbus_message_get_member(message), "PowerOff") ?
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering SPECIAL_POWEROFF_TARGET : SPECIAL_REBOOT_TARGET;
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering return bus_send_error_reply(connection, message, NULL, -ENOMEM);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering freply = dbus_connection_send_with_reply_and_block(connection, forward, -1, &error);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering return bus_send_error_reply(connection, message, &error, -EIO);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering reply = dbus_message_new_method_return(message);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "CanPowerOff") ||
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "CanReboot")) {
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering bool multiple_sessions, challenge, inhibit, b;
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering r = have_multiple_sessions(connection, m, message, &error);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering return bus_send_error_reply(connection, message, &error, r);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering inhibit = manager_is_inhibited(m, INHIBIT_SHUTDOWN, NULL);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering action = streq(dbus_message_get_member(message), "CanPowerOff") ?
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering "org.freedesktop.login1.power-off-multiple-sessions" :
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering "org.freedesktop.login1.reboot-multiple-sessions";
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering r = verify_polkit(connection, message, action, false, &challenge, &error);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering return bus_send_error_reply(connection, message, &error, r);
556a22945fcc88ca27ae7ecc46c9bb2727e37895Lennart Poettering action = streq(dbus_message_get_member(message), "CanPowerOff") ?
556a22945fcc88ca27ae7ecc46c9bb2727e37895Lennart Poettering "org.freedesktop.login1.power-off-ignore-inhibit" :
556a22945fcc88ca27ae7ecc46c9bb2727e37895Lennart Poettering "org.freedesktop.login1.reboot-ignore-inhibit";
556a22945fcc88ca27ae7ecc46c9bb2727e37895Lennart Poettering r = verify_polkit(connection, message, action, false, &challenge, &error);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering return bus_send_error_reply(connection, message, &error, r);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering if (r > 0 && !result)
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering else if (challenge && (!result || streq(result, "yes")))
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering /* If neither inhibit nor multiple sessions
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering * apply then just check the normal policy */
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering action = streq(dbus_message_get_member(message), "CanPowerOff") ?
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering "org.freedesktop.login1.power-off" :
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering "org.freedesktop.login1.reboot";
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering r = verify_polkit(connection, message, action, false, &challenge, &error);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering return bus_send_error_reply(connection, message, &error, r);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering reply = dbus_message_new_method_return(message);
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering } else if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering if (!(reply = dbus_message_new_method_return(message)))
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering /* We roll our own introspection code here, instead of
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering * relying on bus_default_message_handler() because we
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering * need to generate our introspection string
902bb5d8abb2a7d258741828d212ca549ab16950Lennart Poettering * dynamically. */
902bb5d8abb2a7d258741828d212ca549ab16950Lennart Poettering if (!(f = open_memstream(&introspection, &size)))
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering fprintf(f, "<node name=\"seat/%s\"/>", p);
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering fprintf(f, "<node name=\"user/%llu\"/>", (unsigned long long) user->uid);
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering HASHMAP_FOREACH(session, m->sessions, i) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering fprintf(f, "<node name=\"session/%s\"/>", p);
if (ferror(f)) {
fclose(f);
goto oom;
fclose(f);
if (!introspection)
goto oom;
goto oom;
{ NULL, }
if (reply) {
goto oom;
return DBUS_HANDLER_RESULT_HANDLED;
oom:
if (reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
void *userdata) {
assert(m);
const char *cgroup;
DBusMessage *m;
int r = -ENOMEM;
m = bus_properties_changed_new("/org/freedesktop/login1", "org.freedesktop.login1.Manager", properties);
goto finish;
goto finish;