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/pam-module.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/pam-module.c')
-rw-r--r-- | src/login/pam-module.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/login/pam-module.c b/src/login/pam-module.c index 46509245fb..8544413a08 100644 --- a/src/login/pam-module.c +++ b/src/login/pam-module.c @@ -321,7 +321,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( struct passwd *pw; bool kill_processes = false, debug = false; - const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type, *cvtnr = NULL; + const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type, *class, *cvtnr = NULL; char **controllers = NULL, **reset_controllers = NULL, **kill_only_users = NULL, **kill_exclude_users = NULL; DBusError error; uint32_t uid, pid; @@ -465,13 +465,20 @@ _public_ PAM_EXTERN int pam_sm_open_session( type = !isempty(display) ? "x11" : !isempty(tty) ? "tty" : "unspecified"; - remote = !isempty(remote_host) && !streq(remote_host, "localhost") && !streq(remote_host, "localhost.localdomain"); + class = pam_getenv(handle, "XDG_SESSION_CLASS"); + if (isempty(class)) + class = "user"; + + remote = !isempty(remote_host) && + !streq(remote_host, "localhost") && + !streq(remote_host, "localhost.localdomain"); if (!dbus_message_append_args(m, DBUS_TYPE_UINT32, &uid, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_STRING, &service, DBUS_TYPE_STRING, &type, + DBUS_TYPE_STRING, &class, DBUS_TYPE_STRING, &seat, DBUS_TYPE_UINT32, &vtnr, DBUS_TYPE_STRING, &tty, |