pam_rundir: fix conditional and set the user gid for the dir.
This commit is contained in:
parent
e9f869262d
commit
8ed491ded1
|
@ -37,4 +37,3 @@
|
|||
+ prctl (PR_SET_SECUREBITS, (unsigned long) secbits);
|
||||
close (fd); /* also unlocks */
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
from https://github.com/jjk-jacky/pam_rundir/pull/5
|
||||
|
||||
diff --git a/pam_rundir.c b/pam_rundir.c
|
||||
index 2d2c201..67c7ca6 100644
|
||||
--- a/pam_rundir.c
|
||||
+++ b/pam_rundir.c
|
||||
@@ -197,7 +197,7 @@ write_counter (int fd, int count)
|
||||
r = write (fd, buf + w, l - w);
|
||||
if (r < 0)
|
||||
{
|
||||
- if (errno = EINTR)
|
||||
+ if (errno == EINTR)
|
||||
continue;
|
||||
if (w > 0)
|
||||
emergency_invalidate_counter (fd);
|
|
@ -0,0 +1,26 @@
|
|||
backport of https://github.com/jjk-jacky/pam_rundir/pull/8
|
||||
|
||||
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;
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'pam_rundir'
|
||||
pkgname=pam_rundir
|
||||
version=1.0.0
|
||||
revision=5
|
||||
revision=6
|
||||
build_style=configure
|
||||
configure_args="--prefix=/usr --with-parentdir=/run/user"
|
||||
makedepends="pam-devel"
|
||||
|
|
Loading…
Reference in New Issue