From: Thorsten Kukuk Date: Tue, 12 Dec 2006 15:58:01 +0000 (+0000) Subject: Relevant BUGIDs: X-Git-Tag: Linux-PAM-0_99_7_0~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03209d3db52185b8c57ee0f5cccb18aa2c908122;p=linux-pam Relevant BUGIDs: Purpose of commit: bugfix Commit summary: --------------- 2006-12-12 Thorsten Kukuk * libpam/pam_audit.c (_pam_audit_writelog): Print error message on failure to syslog. --- diff --git a/ChangeLog b/ChangeLog index 22333569..01f27162 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-12 Thorsten Kukuk + + * libpam/pam_audit.c (_pam_audit_writelog): Print error + message on failure to syslog. + 2006-12-09 Thorsten Kukuk * modules/pam_umask/pam_umask.c: Use strtoul instead of strtol, diff --git a/libpam/pam_audit.c b/libpam/pam_audit.c index 4399e5c6..05be989c 100644 --- a/libpam/pam_audit.c +++ b/libpam/pam_audit.c @@ -22,18 +22,21 @@ #define PAMAUDIT_LOGGED 1 static int -_pam_audit_writelog(pam_handle_t *pamh, int audit_fd, int type, +_pam_audit_writelog(pam_handle_t *pamh, int audit_fd, int type, const char *message, int retval) { int rc; char buf[256]; - snprintf(buf, sizeof(buf), "PAM: %s acct=%s ", message, + snprintf(buf, sizeof(buf), "PAM: %s acct=%s ", message, (retval != PAM_USER_UNKNOWN && pamh->user) ? pamh->user : "?"); rc = audit_log_user_message( audit_fd, type, buf, pamh->rhost, NULL, pamh->tty, retval == PAM_SUCCESS ); + if (rc == -1) + pam_syslog(pamh, LOG_CRIT, "audit_log_user_message() failed: %m"); + pamh->audit_state |= PAMAUDIT_LOGGED; return rc; } @@ -59,7 +62,7 @@ _pam_auditlog(pam_handle_t *pamh, int action, int retval, int flags) pam_syslog(pamh, LOG_CRIT, "audit_open() failed: %m"); return PAM_SYSTEM_ERR; } - + switch (action) { case PAM_AUTHENTICATE: message = "authentication"; @@ -105,7 +108,7 @@ _pam_auditlog(pam_handle_t *pamh, int action, int retval, int flags) if (_pam_audit_writelog(pamh, audit_fd, type, message, retval) < 0) retval = PAM_SYSTEM_ERR; - + audit_close(audit_fd); return retval; }