From 1fce4ca79b9e84ad6df23c5d2fd8171712873182 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 12 Aug 2024 17:37:03 +0200 Subject: [PATCH] Treat out of memory as error Otherwise it might happen that a configured file location is not taken into account. A NULL value would lead to default file location. Gbp-Pq: Topic upstream-master Gbp-Pq: Name Treat-out-of-memory-as-error.patch --- pam_lastlog2/src/pam_lastlog2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pam_lastlog2/src/pam_lastlog2.c b/pam_lastlog2/src/pam_lastlog2.c index e800700..c3ca989 100644 --- a/pam_lastlog2/src/pam_lastlog2.c +++ b/pam_lastlog2/src/pam_lastlog2.c @@ -189,6 +189,8 @@ write_login_data (pam_handle_t *pamh, int ctrl, const char *user) return PAM_SYSTEM_ERR; struct ll2_context *context = ll2_new_context(lastlog2_path); + if (context == NULL) + return PAM_SYSTEM_ERR; if (ll2_write_entry (context, user, ll_time, tty, rhost, pam_service, &error) != 0) { if (error) { @@ -220,6 +222,8 @@ show_lastlogin (pam_handle_t *pamh, int ctrl, const char *user) return retval; struct ll2_context *context = ll2_new_context(lastlog2_path); + if (context == NULL) + return PAM_SYSTEM_ERR; if (ll2_read_entry (context, user, &ll_time, &tty, &rhost, &service, &error) != 0) { if (errno == ENOENT) -- 2.30.2