aboutsummaryrefslogtreecommitdiffstats
path: root/community/pam-rundir/fix-group-of-user-dir.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/pam-rundir/fix-group-of-user-dir.patch')
-rw-r--r--community/pam-rundir/fix-group-of-user-dir.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/community/pam-rundir/fix-group-of-user-dir.patch b/community/pam-rundir/fix-group-of-user-dir.patch
new file mode 100644
index 00000000000..4f39f16373f
--- /dev/null
+++ b/community/pam-rundir/fix-group-of-user-dir.patch
@@ -0,0 +1,39 @@
+From 9cf828e1c103ae260a056e7c335f4638c9add7b1 Mon Sep 17 00:00:00 2001
+From: Dudemanguy <dudemanguy@artixlinux.org>
+Date: Sat, 18 Sep 2021 09:58:46 -0500
+Subject: [PATCH] fix group permissions of the user folders
+
+When making a directory, the user was correctly given ownership but the
+group was still root. In elogind (and likely system-logind), these
+folders are owned by user:user. Fix this by also setting the egid to
+the user's group.
+---
+ pam_rundir.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Patch-Source: https://gitea.artixlinux.org/artix/pam_rundir/commit/9cf828e1c103ae260a056e7c335f4638c9add7b1
+
+diff --git a/pam_rundir.c b/pam_rundir.c
+index d36584d..f92c73e 100644
+--- a/pam_rundir.c
++++ b/pam_rundir.c
+@@ -404,8 +404,8 @@
+ secbits = prctl (PR_GET_SECUREBITS);
+ if (secbits != -1)
+ prctl (PR_SET_SECUREBITS, (unsigned long) secbits | SECBIT_NO_SETUID_FIXUP);
+- /* set euid so if we do create the dir, it is own by the user */
+- if (seteuid (pw->pw_uid) < 0)
++ /* set euid and egid so if we do create the dir, it is owned by the user */
++ if (seteuid (pw->pw_uid) < 0 || setegid (pw->pw_gid) < 0)
+ {
+ r = -1;
+ goto done;
+@@ -422,7 +422,7 @@
+ pam_putenv (pamh, buf);
+ }
+ /* restore */
+- if (seteuid (0) < 0)
++ if (seteuid (0) < 0 || setegid (0) < 0)
+ {
+ r = -1;
+ goto done;