]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam_systemd: always set XDG_SESSION_{CLASS|TYPE|DESKTOP}
authorLennart Poettering <lennart@poettering.net>
Fri, 20 Jul 2018 09:28:37 +0000 (11:28 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 25 Jul 2018 14:09:33 +0000 (16:09 +0200)
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.

src/login/pam_systemd.c

index a9d0fdb5b7de079dacb7acb8ef6b171d1790b38e..a01963622dc143a1840f460e063ae7b3d600fa1c 100644 (file)
@@ -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;