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