summaryrefslogtreecommitdiff
path: root/pcr/elogind/protect-user-XDG_RUNTIME_DIR.patch
blob: c97569ce85557d7ed12a4cd7e5dd72c69ce5ecc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
github.com/linuxmint/systemd-betsy commit-hash f7ab85f1e1169ac1598dfc1fba1c01063840b3c5


Orignal Commit Author: https://github.com/clefebvre
===================================================================
--- elogind-234.4.orig/src/login/pam_elogind.c
+++ elogind-234.4/src/login/pam_elogind.c
@@ -463,6 +463,15 @@
                 if (r != PAM_SUCCESS)
                         return r;
         }
+        else {
+                if (pw->pw_uid == 0) {
+                        r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", "/run/user/0", 0);
+                        if (r != PAM_SUCCESS) {
+                                pam_syslog(handle, LOG_ERR, "Failed to set runtime dir for UID 0.");
+                                return r;
+                        }
+                }
+        }
 
         if (!isempty(seat)) {
                 r = pam_misc_setenv(handle, "XDG_SEAT", seat, 0);