diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-02-14 21:33:51 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-02-14 21:37:49 +0100 |
commit | 55efac6cbcea0d8edda9c6820620ceb390009e7a (patch) | |
tree | 4cd4a938607d1ee6b8fd20e40d49d441bf134117 /src/login/logind-dbus.c | |
parent | 6edd7ca1624f89c9a36067b721a0280e748acb17 (diff) |
login: track login class (i.e. one of "user", "greeter", "lock-screen") for each session
This introduces the new PAM environment variable XDG_SESSION_CLASS. If
not set, defaults to "user".
This is useful for apps that want to distuingish real user logins from
"fake" ones which just exist to show a gdm login screen or a lock
screen.
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r-- | src/login/logind-dbus.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 7794ab917e..d8f4d89474 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -62,6 +62,7 @@ " <arg name=\"leader\" type=\"u\" direction=\"in\"/>\n" \ " <arg name=\"sevice\" type=\"s\" direction=\"in\"/>\n" \ " <arg name=\"type\" type=\"s\" direction=\"in\"/>\n" \ + " <arg name=\"class\" type=\"s\" direction=\"in\"/>\n" \ " <arg name=\"seat\" type=\"s\" direction=\"in\"/>\n" \ " <arg name=\"vtnr\" type=\"u\" direction=\"in\"/>\n" \ " <arg name=\"tty\" type=\"s\" direction=\"in\"/>\n" \ @@ -222,11 +223,12 @@ static int bus_manager_append_idle_hint_since(DBusMessageIter *i, const char *pr static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMessage **_reply) { Session *session = NULL; User *user = NULL; - const char *type, *seat, *tty, *display, *remote_user, *remote_host, *service; + const char *type, *class, *seat, *tty, *display, *remote_user, *remote_host, *service; uint32_t uid, leader, audit_id = 0; dbus_bool_t remote, kill_processes; char **controllers = NULL, **reset_controllers = NULL; SessionType t; + SessionClass c; Seat *s; DBusMessageIter iter; int r; @@ -271,6 +273,17 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) return -EINVAL; + dbus_message_iter_get_basic(&iter, &class); + if (isempty(class)) + c = SESSION_USER; + else + c = session_class_from_string(class); + + if (c < 0 || + !dbus_message_iter_next(&iter) || + dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return -EINVAL; + dbus_message_iter_get_basic(&iter, &seat); if (isempty(seat)) @@ -467,6 +480,7 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess session->leader = leader; session->audit_id = audit_id; session->type = t; + session->class = c; session->remote = remote; session->controllers = controllers; session->reset_controllers = reset_controllers; |