From e3309f060a67805e679fee55b1101b91991ea824 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 15 Jan 2024 20:05:28 +0100 Subject: pam_unix: fix regressions The returned value stored in pwd from _unix_getpwnam is inserted into pam handler through pam_set_data. Do not manually free the value. Also check getline return value for != -1 instead of == -1. Fixes 8f2ca5919b26843ef774ef0aeb9bf261dec943a0 and 73d009e9ea8edafc18c7fe3650b25dd6bdce88c1. No release affected. Signed-off-by: Tobias Stoeckmann --- modules/pam_unix/pam_unix_passwd.c | 1 - modules/pam_unix/passverify.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/pam_unix') diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c index 7c141c3b..fe3f566a 100644 --- a/modules/pam_unix/pam_unix_passwd.c +++ b/modules/pam_unix/pam_unix_passwd.c @@ -660,7 +660,6 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv) user); return PAM_USER_UNKNOWN; } - _pam_drop(pwd); /* * This is not an AUTH module! diff --git a/modules/pam_unix/passverify.c b/modules/pam_unix/passverify.c index 045ea785..60d9ceca 100644 --- a/modules/pam_unix/passverify.c +++ b/modules/pam_unix/passverify.c @@ -729,7 +729,7 @@ save_old_password(pam_handle_t *pamh, const char *forwho, const char *oldpass, goto done; } - while (getline(&buf, &bufsize, opwfile) == -1) { + while (getline(&buf, &bufsize, opwfile) != -1) { if (!strncmp(buf, forwho, len) && strchr(":,\n", buf[len]) != NULL) { char *ep, *sptr = NULL; long value; -- cgit v1.2.3