Hi,
this patch by Richard Briggs adds backwards compatibility with old
kernels that do not support the log_password functionality if you
compile PAM against new kernel headers.
diff --git a/modules/pam_tty_audit/pam_tty_audit.c
b/modules/pam_tty_audit/pam_tty_audit.c
index cc86255..a1a3aa4 100644
--- a/modules/pam_tty_audit/pam_tty_audit.c
+++ b/modules/pam_tty_audit/pam_tty_audit.c
@@ -109,7 +109,7 @@ nl_recv (int fd, unsigned type, void *buf, size_t size)
struct msghdr msg;
struct nlmsghdr nlm;
struct iovec iov[2];
- ssize_t res;
+ ssize_t res, resdiff;
again:
iov[0].iov_base = &nlm;
@@ -161,12 +161,17 @@ nl_recv (int fd, unsigned type, void *buf, size_t size)
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(buf[size - resdiff], 0, resdiff);
+ }
return 0;
}
OK to commit?
--
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
(You'll never know whether the road is wrong though.)
Show replies by date