From: Lennart Poettering Date: Fri, 20 Jul 2018 09:28:37 +0000 (+0200) Subject: pam_systemd: always set XDG_SESSION_{CLASS|TYPE|DESKTOP} X-Git-Tag: v240~895^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2f74f079dce955c1aa8d9cdcd602a4127157581;p=thirdparty%2Fsystemd.git pam_systemd: always set XDG_SESSION_{CLASS|TYPE|DESKTOP} We likely get the data from the env block, but we might also determine it from elsewhere (such as PAM module parameters). Let's set the env vars on the env block explicitly, so that they are available always, and apps can rely on it. --- diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index a9d0fdb5b7d..a01963622dc 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -553,6 +553,22 @@ _public_ PAM_EXTERN int pam_sm_open_session( return r; } + /* Most likely we got the session/type/class from environment variables, but might have gotten the data + * somewhere else (for example PAM module parameters). Let's now update the environment variables, so that this + * data is inherited into the session processes, and programs can rely on them to be initialized. */ + + r = update_environment(handle, "XDG_SESSION_TYPE", type); + if (r != PAM_SUCCESS) + return r; + + r = update_environment(handle, "XDG_SESSION_CLASS", class); + if (r != PAM_SUCCESS) + return r; + + r = update_environment(handle, "XDG_SESSION_DESKTOP", desktop); + if (r != PAM_SUCCESS) + return r; + r = update_environment(handle, "XDG_SEAT", seat); if (r != PAM_SUCCESS) return r;