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