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

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