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