-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pam_rundir: fix conditional and set the user gid for the dir.
- Loading branch information
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,3 @@ | |
+ prctl (PR_SET_SECUREBITS, (unsigned long) secbits); | ||
close (fd); /* also unlocks */ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters