aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2024-08-16 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2024-08-16 08:00:00 +0000
commitfba347d87076a0efe7855fd345124fd5345e986e (patch)
treed1a94c4f58778983218b9a1b5df89ca1165f2e02 /modules
parent7ff671084f54c81107dd22d8574e6a765b0b951b (diff)
downloadpam-fba347d87076a0efe7855fd345124fd5345e986e.tar.gz
pam-fba347d87076a0efe7855fd345124fd5345e986e.tar.bz2
pam-fba347d87076a0efe7855fd345124fd5345e986e.zip
pam_faillock: fix compilation warning
* modules/pam_faillock/pam_faillock.c (check_tally, write_tally) [HAVE_LIBAUDIT]: Check audit_log_user_message() return value.
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_faillock/pam_faillock.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/pam_faillock/pam_faillock.c b/modules/pam_faillock/pam_faillock.c
index f39a9d95..038a95ea 100644
--- a/modules/pam_faillock/pam_faillock.c
+++ b/modules/pam_faillock/pam_faillock.c
@@ -253,8 +253,10 @@ check_tally(pam_handle_t *pamh, struct options *opts, struct tally_data *tallies
(void)pam_get_item(pamh, PAM_TTY, &tty);
(void)pam_get_item(pamh, PAM_RHOST, &rhost);
snprintf(buf, sizeof(buf), "op=pam_faillock suid=%u ", opts->uid);
- audit_log_user_message(audit_fd, AUDIT_RESP_ACCT_UNLOCK_TIMED, buf,
- rhost, NULL, tty, 1);
+ if (audit_log_user_message(audit_fd, AUDIT_RESP_ACCT_UNLOCK_TIMED, buf,
+ rhost, NULL, tty, 1) <= 0)
+ pam_syslog(pamh, LOG_ERR,
+ "Error sending audit message: %m");
audit_close(audit_fd);
}
#endif
@@ -370,12 +372,16 @@ write_tally(pam_handle_t *pamh, struct options *opts, struct tally_data *tallies
return PAM_SYSTEM_ERR;
snprintf(buf, sizeof(buf), "op=pam_faillock suid=%u ", opts->uid);
- audit_log_user_message(audit_fd, AUDIT_ANOM_LOGIN_FAILURES, buf,
- NULL, NULL, NULL, 1);
+ if (audit_log_user_message(audit_fd, AUDIT_ANOM_LOGIN_FAILURES, buf,
+ NULL, NULL, NULL, 1) <= 0)
+ pam_syslog(pamh, LOG_ERR,
+ "Error sending audit message: %m");
if (!opts->is_admin || (opts->flags & FAILLOCK_FLAG_DENY_ROOT)) {
- audit_log_user_message(audit_fd, AUDIT_RESP_ACCT_LOCK, buf,
- NULL, NULL, NULL, 1);
+ if (audit_log_user_message(audit_fd, AUDIT_RESP_ACCT_LOCK, buf,
+ NULL, NULL, NULL, 1) <= 0)
+ pam_syslog(pamh, LOG_ERR,
+ "Error sending audit message: %m");
}
close(audit_fd);
#endif