Petr Šabata 33fc6c
diff -up bash-4.2/config.h.in.audit bash-4.2/config.h.in
Petr Šabata 33fc6c
--- bash-4.2/config.h.in.audit	2013-01-31 16:26:16.857698992 +0100
Petr Šabata 33fc6c
+++ bash-4.2/config.h.in	2013-01-31 16:26:16.876699255 +0100
Petr Šabata 33fc6c
@@ -1131,6 +1131,14 @@
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
 /* End additions for lib/intl */
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
+/* Additions for lib/readline */
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
+/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
Petr Šabata 33fc6c
+#undef HAVE_DECL_AUDIT_USER_TTY
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
+/* End additions for lib/readline */
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
 #include "config-bot.h"
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
 #endif /* _CONFIG_H_ */
Petr Šabata 33fc6c
diff -up bash-4.2/configure.in.audit bash-4.2/configure.in
Petr Šabata 33fc6c
--- bash-4.2/configure.in.audit	2013-01-31 16:26:16.858699005 +0100
Petr Šabata 33fc6c
+++ bash-4.2/configure.ac	2013-01-31 16:26:16.877699269 +0100
Petr Šabata 33fc6c
@@ -888,6 +888,8 @@ BASH_FUNC_DUP2_CLOEXEC_CHECK
Petr Šabata 33fc6c
 BASH_SYS_PGRP_SYNC
Petr Šabata 33fc6c
 BASH_SYS_SIGNAL_VINTAGE
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
+AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
 dnl checking for the presence of certain library symbols
Petr Šabata 33fc6c
 BASH_SYS_ERRLIST
Petr Šabata 33fc6c
 BASH_SYS_SIGLIST
Petr Šabata 33fc6c
diff -up bash-4.2/lib/readline/readline.c.audit bash-4.2/lib/readline/readline.c
Petr Šabata 33fc6c
--- bash-4.2/lib/readline/readline.c.audit	2013-01-31 16:26:16.871699185 +0100
Petr Šabata 33fc6c
+++ bash-4.2/lib/readline/readline.c	2013-01-31 17:24:23.902744860 +0100
Petr Šabata 33fc6c
@@ -55,6 +55,12 @@
Petr Šabata 33fc6c
 extern int errno;
Petr Šabata 33fc6c
 #endif /* !errno */
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
Petr Šabata 33fc6c
+#  include <sys/socket.h>
Petr Šabata 33fc6c
+#  include <linux/audit.h>
Petr Šabata 33fc6c
+#  include <linux/netlink.h>
Petr Šabata 33fc6c
+#endif
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
 /* System-specific feature definitions and include files. */
Petr Šabata 33fc6c
 #include "rldefs.h"
Petr Šabata 33fc6c
 #include "rlmbutil.h"
Petr Šabata 33fc6c
@@ -301,7 +307,48 @@ rl_set_prompt (prompt)
Petr Šabata 33fc6c
   rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
Petr Šabata 33fc6c
   return 0;
Petr Šabata 33fc6c
 }
Petr Šabata 33fc6c
-  
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
Petr Šabata 33fc6c
+/* Report STRING to the audit system. */
Petr Šabata 33fc6c
+static void
Petr Šabata 33fc6c
+audit_tty (char *string)
Petr Šabata 33fc6c
+{
Petr Šabata 33fc6c
+  struct sockaddr_nl addr;
Petr Šabata 33fc6c
+  struct msghdr msg;
Petr Šabata 33fc6c
+  struct nlmsghdr nlm;
Petr Šabata 33fc6c
+  struct iovec iov[2];
Petr Šabata 33fc6c
+  size_t size;
Petr Šabata 33fc6c
+  int fd;
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
+  size = strlen (string) + 1;
Petr Šabata 33fc6c
+  fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
Petr Šabata 33fc6c
+  if (fd < 0)
Petr Šabata 33fc6c
+    return;
Petr Šabata 33fc6c
+  nlm.nlmsg_len = NLMSG_LENGTH (size);
Petr Šabata 33fc6c
+  nlm.nlmsg_type = AUDIT_USER_TTY;
Petr Šabata 33fc6c
+  nlm.nlmsg_flags = NLM_F_REQUEST;
Petr Šabata 33fc6c
+  nlm.nlmsg_seq = 0;
Petr Šabata 33fc6c
+  nlm.nlmsg_pid = 0;
Petr Šabata 33fc6c
+  iov[0].iov_base = &nlm;
Petr Šabata 33fc6c
+  iov[0].iov_len = sizeof (nlm);
Petr Šabata 33fc6c
+  iov[1].iov_base = string;
Petr Šabata 33fc6c
+  iov[1].iov_len = size;
Petr Šabata 33fc6c
+  addr.nl_family = AF_NETLINK;
Petr Šabata 33fc6c
+  addr.nl_pad = 0;
Petr Šabata 33fc6c
+  addr.nl_pid = 0;
Petr Šabata 33fc6c
+  addr.nl_groups = 0;
Petr Šabata 33fc6c
+  msg.msg_name = &addr;
Petr Šabata 33fc6c
+  msg.msg_namelen = sizeof (addr);
Petr Šabata 33fc6c
+  msg.msg_iov = iov;
Petr Šabata 33fc6c
+  msg.msg_iovlen = 2;
Petr Šabata 33fc6c
+  msg.msg_control = NULL;
Petr Šabata 33fc6c
+  msg.msg_controllen = 0;
Petr Šabata 33fc6c
+  msg.msg_flags = 0;
Petr Šabata 33fc6c
+  (void)sendmsg (fd, &msg, 0);
Petr Šabata 33fc6c
+  close (fd);
Petr Šabata 33fc6c
+}
Petr Šabata 33fc6c
+#endif
Petr Šabata 33fc6c
+
Petr Šabata 33fc6c
 /* Read a line of input.  Prompt with PROMPT.  An empty PROMPT means
Petr Šabata 33fc6c
    none.  A return value of NULL means that EOF was encountered. */
Petr Šabata 33fc6c
 char *