From 76af6380776a81ffd6ff50de254fb448ec6bce79 Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Thu, 4 Jan 2024 17:46:51 +0100 Subject: pam_timestamp: correct failure condition Bail out on NULL pointer, not otherwise. Reported by cppcheck. Fixes: 8a3f0810 ("Y2038: use logind instead of utmp") --- modules/pam_timestamp/pam_timestamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/pam_timestamp') diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c index 08300164..7c5457c4 100644 --- a/modules/pam_timestamp/pam_timestamp.c +++ b/modules/pam_timestamp/pam_timestamp.c @@ -557,7 +557,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) } #ifdef USE_LOGIND struct passwd *pwd = pam_modutil_getpwnam(pamh, ruser); - if (pwd != NULL) { + if (pwd == NULL) { return PAM_SERVICE_ERR; } if (check_login_time(pwd->pw_uid, then) != PAM_SUCCESS) -- cgit v1.2.3