aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2023-12-12 21:05:08 +0100
committerDmitry V. Levin <ldv@strace.io>2023-12-12 20:05:08 +0000
commitf6a171e5c7bcb7c0bf56ea0dc81e3b6843670fc4 (patch)
tree6f955259d918eeafecff2d3d832a155be7c1998e /modules
parent2c711ce57ced9f97c2cf4c8d59c1730447a7bd7f (diff)
downloadpam-f6a171e5c7bcb7c0bf56ea0dc81e3b6843670fc4.tar.gz
pam-f6a171e5c7bcb7c0bf56ea0dc81e3b6843670fc4.tar.bz2
pam-f6a171e5c7bcb7c0bf56ea0dc81e3b6843670fc4.zip
pam_shells: fix regression
The \n at the end of a line has to be removed, otherwise the strcmp check will always fail. Fixes: f800c5a85330 ("pam_shells: limit shells to absolute paths") Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_shells/pam_shells.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/pam_shells/pam_shells.c b/modules/pam_shells/pam_shells.c
index 2fae67cf..3e639ed0 100644
--- a/modules/pam_shells/pam_shells.c
+++ b/modules/pam_shells/pam_shells.c
@@ -140,6 +140,7 @@ static int perform_check(pam_handle_t *pamh)
getdelim(&p, &n, '\n', shellFile)
#endif
!= -1) {
+ p[strcspn(p, "\n")] = '\0';
if (p[0] != '/') {
continue;
@@ -161,6 +162,7 @@ static int perform_check(pam_handle_t *pamh)
ignore = 0;
continue;
}
+ *p = '\0';
if (buf[0] != '/') {
continue;