]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorThorsten Kukuk <kukuk@thkukuk.de>
Tue, 12 Dec 2006 15:58:01 +0000 (15:58 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Tue, 12 Dec 2006 15:58:01 +0000 (15:58 +0000)
Purpose of commit: bugfix

Commit summary:
---------------

2006-12-12  Thorsten Kukuk  <kukuk@thkukuk.de>

        * libpam/pam_audit.c (_pam_audit_writelog): Print error
        message on failure to syslog.

ChangeLog
libpam/pam_audit.c

index 22333569a6d06780537981f6ecc9ecdf097c13a0..01f27162e0ba51ad6cde9b4694977e3a8802a889 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-12  Thorsten Kukuk  <kukuk@thkukuk.de>
+
+       * libpam/pam_audit.c (_pam_audit_writelog): Print error
+       message on failure to syslog.
+
 2006-12-09  Thorsten Kukuk  <kukuk@thkukuk.de>
 
        * modules/pam_umask/pam_umask.c: Use strtoul instead of strtol,
index 4399e5c6226b752f2ada8e7965d0011c6bd81828..05be989cf2872d49471dc692f0a50caff07d6095 100644 (file)
 #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;
 }