1 diff -up readline-6.1/config.h.in.audit readline-6.1/config.h.in
2 --- readline-6.1/config.h.in.audit 2009-03-10 15:57:45.000000000 +0100
3 +++ readline-6.1/config.h.in 2011-01-18 15:14:51.199219895 +0100
6 #undef __CHAR_UNSIGNED__
8 +/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
9 +#undef HAVE_DECL_AUDIT_USER_TTY
11 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
12 #undef STAT_MACROS_BROKEN
14 diff -up readline-6.1/configure.audit readline-6.1/configure
15 --- readline-6.1/configure.audit 2009-12-29 23:33:49.000000000 +0100
16 +++ readline-6.1/configure 2011-01-18 15:21:20.571330373 +0100
17 @@ -6602,7 +6602,9 @@ _ACEOF
22 +cat >>confdefs.h <<_ACEOF
23 +#define HAVE_DECL_AUDIT_USER_TTY 1
26 { $as_echo "$as_me:$LINENO: checking if signal handlers must be reinstalled when invoked" >&5
27 $as_echo_n "checking if signal handlers must be reinstalled when invoked... " >&6; }
28 diff -up readline-6.1/configure.in.audit readline-6.1/configure.in
29 --- readline-6.1/configure.in.audit 2009-10-12 16:12:15.000000000 +0200
30 +++ readline-6.1/configure.in 2011-01-18 15:14:51.199219895 +0100
31 @@ -159,6 +159,8 @@ AC_CHECK_HEADERS(sys/ptem.h,,,
35 +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
37 BASH_SYS_SIGNAL_VINTAGE
38 BASH_SYS_REINSTALL_SIGHANDLERS
40 diff -up readline-6.1/readline.c.audit readline-6.1/readline.c
41 --- readline-6.1/readline.c.audit 2009-08-31 14:45:31.000000000 +0200
42 +++ readline-6.1/readline.c 2011-01-18 15:14:51.200219841 +0100
47 +#if defined (HAVE_DECL_AUDIT_USER_TTY)
48 +# include <sys/socket.h>
49 +# include <linux/audit.h>
50 +# include <linux/netlink.h>
53 /* System-specific feature definitions and include files. */
56 @@ -301,7 +307,47 @@ rl_set_prompt (prompt)
57 rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
62 +#if defined (HAVE_DECL_AUDIT_USER_TTY)
63 +/* Report STRING to the audit system. */
65 +audit_tty (char *string)
67 + struct sockaddr_nl addr;
69 + struct nlmsghdr nlm;
70 + struct iovec iov[2];
74 + size = strlen (string) + 1;
75 + fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
78 + nlm.nlmsg_len = NLMSG_LENGTH (size);
79 + nlm.nlmsg_type = AUDIT_USER_TTY;
80 + nlm.nlmsg_flags = NLM_F_REQUEST;
83 + iov[0].iov_base = &nlm;
84 + iov[0].iov_len = sizeof (nlm);
85 + iov[1].iov_base = string;
86 + iov[1].iov_len = size;
87 + addr.nl_family = AF_NETLINK;
90 + msg.msg_name = &addr;
91 + msg.msg_namelen = sizeof (addr);
94 + msg.msg_control = NULL;
95 + msg.msg_controllen = 0;
97 + (void)sendmsg (fd, &msg, 0);
102 /* Read a line of input. Prompt with PROMPT. An empty PROMPT means
103 none. A return value of NULL means that EOF was encountered. */
105 @@ -352,6 +398,11 @@ readline (prompt)
106 RL_SETSTATE (RL_STATE_CALLBACK);
109 +#if defined (HAVE_DECL_AUDIT_USER_TTY)