Blame SOURCES/pam-1.1.7-tty-audit-init.patch

904b9f
diff -up Linux-PAM-1.1.7/modules/pam_tty_audit/pam_tty_audit.c.tty-audit-init Linux-PAM-1.1.7/modules/pam_tty_audit/pam_tty_audit.c
904b9f
--- Linux-PAM-1.1.7/modules/pam_tty_audit/pam_tty_audit.c.tty-audit-init	2013-08-28 10:53:40.000000000 +0200
904b9f
+++ Linux-PAM-1.1.7/modules/pam_tty_audit/pam_tty_audit.c	2013-10-04 14:51:19.944994905 +0200
904b9f
@@ -36,6 +36,7 @@
904b9f
    USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
904b9f
    DAMAGE. */
904b9f
 
904b9f
+#include "config.h"
904b9f
 #include <errno.h>
904b9f
 #include <fnmatch.h>
904b9f
 #include <stdlib.h>
904b9f
@@ -108,7 +109,7 @@ nl_recv (int fd, unsigned type, void *bu
904b9f
   struct msghdr msg;
904b9f
   struct nlmsghdr nlm;
904b9f
   struct iovec iov[2];
904b9f
-  ssize_t res;
904b9f
+  ssize_t res, resdiff;
904b9f
 
904b9f
  again:
904b9f
   iov[0].iov_base = &nlm;
904b9f
@@ -160,12 +161,17 @@ nl_recv (int fd, unsigned type, void *bu
904b9f
   res = recvmsg (fd, &msg, 0);
904b9f
   if (res == -1)
904b9f
     return -1;
904b9f
-  if ((size_t)res != NLMSG_LENGTH (size)
904b9f
+  resdiff = NLMSG_LENGTH(size) - (size_t)res;
904b9f
+  if (resdiff < 0
904b9f
       || nlm.nlmsg_type != type)
904b9f
     {
904b9f
       errno = EIO;
904b9f
       return -1;
904b9f
     }
904b9f
+  else if (resdiff > 0)
904b9f
+    {
904b9f
+      memset((char *)buf + size - resdiff, 0, resdiff);
904b9f
+    }
904b9f
   return 0;
904b9f
 }
904b9f
 
904b9f
@@ -275,6 +281,8 @@ pam_sm_open_session (pam_handle_t *pamh,
904b9f
       return PAM_SESSION_ERR;
904b9f
     }
904b9f
 
904b9f
+  memcpy(&new_status, old_status, sizeof(new_status));
904b9f
+
904b9f
   new_status.enabled = (command == CMD_ENABLE ? 1 : 0);
904b9f
 #ifdef HAVE_STRUCT_AUDIT_TTY_STATUS_LOG_PASSWD
904b9f
   new_status.log_passwd = log_passwd;