From f6a171e5c7bcb7c0bf56ea0dc81e3b6843670fc4 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Tue, 12 Dec 2023 21:05:08 +0100 Subject: 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 --- modules/pam_shells/pam_shells.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/pam_shells') 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; -- cgit v1.2.3