]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - readline/patches/readline-6.1-audit.patch
tzdata: Update to 2014j
[people/ms/ipfire-3.x.git] / readline / patches / readline-6.1-audit.patch
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
4 @@ -29,6 +29,9 @@
5
6 #undef __CHAR_UNSIGNED__
7
8 +/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
9 +#undef HAVE_DECL_AUDIT_USER_TTY
10 +
11 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
12 #undef STAT_MACROS_BROKEN
13
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
18
19 fi
20
21 -
22 +cat >>confdefs.h <<_ACEOF
23 +#define HAVE_DECL_AUDIT_USER_TTY 1
24 +_ACEOF
25
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,,,
32
33 AC_SYS_LARGEFILE
34
35 +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
36 +
37 BASH_SYS_SIGNAL_VINTAGE
38 BASH_SYS_REINSTALL_SIGHANDLERS
39
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
43 @@ -55,6 +55,12 @@
44 extern int errno;
45 #endif /* !errno */
46
47 +#if defined (HAVE_DECL_AUDIT_USER_TTY)
48 +# include <sys/socket.h>
49 +# include <linux/audit.h>
50 +# include <linux/netlink.h>
51 +#endif
52 +
53 /* System-specific feature definitions and include files. */
54 #include "rldefs.h"
55 #include "rlmbutil.h"
56 @@ -301,7 +307,47 @@ rl_set_prompt (prompt)
57 rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
58 return 0;
59 }
60 -
61 +
62 +#if defined (HAVE_DECL_AUDIT_USER_TTY)
63 +/* Report STRING to the audit system. */
64 +static void
65 +audit_tty (char *string)
66 +{
67 + struct sockaddr_nl addr;
68 + struct msghdr msg;
69 + struct nlmsghdr nlm;
70 + struct iovec iov[2];
71 + size_t size;
72 + int fd;
73 +
74 + size = strlen (string) + 1;
75 + fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
76 + if (fd < 0)
77 + return;
78 + nlm.nlmsg_len = NLMSG_LENGTH (size);
79 + nlm.nlmsg_type = AUDIT_USER_TTY;
80 + nlm.nlmsg_flags = NLM_F_REQUEST;
81 + nlm.nlmsg_seq = 0;
82 + nlm.nlmsg_pid = 0;
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;
88 + addr.nl_pid = 0;
89 + addr.nl_groups = 0;
90 + msg.msg_name = &addr;
91 + msg.msg_namelen = sizeof (addr);
92 + msg.msg_iov = iov;
93 + msg.msg_iovlen = 2;
94 + msg.msg_control = NULL;
95 + msg.msg_controllen = 0;
96 + msg.msg_flags = 0;
97 + (void)sendmsg (fd, &msg, 0);
98 + close (fd);
99 +}
100 +#endif
101 +
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. */
104 char *
105 @@ -352,6 +398,11 @@ readline (prompt)
106 RL_SETSTATE (RL_STATE_CALLBACK);
107 #endif
108
109 +#if defined (HAVE_DECL_AUDIT_USER_TTY)
110 + if (value != NULL)
111 + audit_tty (value);
112 +#endif
113 +
114 return (value);
115 }
116