]>
Commit | Line | Data |
---|---|---|
56ba7d19 MT |
1 | diff -up bash-4.2/config.h.in.audit bash-4.2/config.h.in |
2 | --- bash-4.2/config.h.in.audit 2013-01-31 16:26:16.857698992 +0100 | |
3 | +++ bash-4.2/config.h.in 2013-01-31 16:26:16.876699255 +0100 | |
4 | @@ -1131,6 +1131,14 @@ | |
5 | ||
6 | /* End additions for lib/intl */ | |
7 | ||
8 | + | |
9 | +/* Additions for lib/readline */ | |
10 | + | |
11 | +/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */ | |
12 | +#undef HAVE_DECL_AUDIT_USER_TTY | |
13 | + | |
14 | +/* End additions for lib/readline */ | |
15 | + | |
16 | #include "config-bot.h" | |
17 | ||
18 | #endif /* _CONFIG_H_ */ | |
19 | diff -up bash-4.2/configure.in.audit bash-4.2/configure.in | |
20 | --- bash-4.2/configure.in.audit 2013-01-31 16:26:16.858699005 +0100 | |
21 | +++ bash-4.2/configure.ac 2013-01-31 16:26:16.877699269 +0100 | |
22 | @@ -888,6 +888,8 @@ BASH_FUNC_DUP2_CLOEXEC_CHECK | |
23 | BASH_SYS_PGRP_SYNC | |
24 | BASH_SYS_SIGNAL_VINTAGE | |
25 | ||
26 | +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]]) | |
27 | + | |
28 | dnl checking for the presence of certain library symbols | |
29 | BASH_SYS_ERRLIST | |
30 | BASH_SYS_SIGLIST | |
31 | diff -up bash-4.2/lib/readline/readline.c.audit bash-4.2/lib/readline/readline.c | |
32 | --- bash-4.2/lib/readline/readline.c.audit 2013-01-31 16:26:16.871699185 +0100 | |
33 | +++ bash-4.2/lib/readline/readline.c 2013-01-31 17:24:23.902744860 +0100 | |
34 | @@ -55,6 +55,12 @@ | |
35 | extern int errno; | |
36 | #endif /* !errno */ | |
37 | ||
38 | +#if defined (HAVE_DECL_AUDIT_USER_TTY) | |
39 | +# include <sys/socket.h> | |
40 | +# include <linux/audit.h> | |
41 | +# include <linux/netlink.h> | |
42 | +#endif | |
43 | + | |
44 | /* System-specific feature definitions and include files. */ | |
45 | #include "rldefs.h" | |
46 | #include "rlmbutil.h" | |
47 | @@ -301,7 +307,48 @@ rl_set_prompt (prompt) | |
48 | rl_visible_prompt_length = rl_expand_prompt (rl_prompt); | |
49 | return 0; | |
50 | } | |
51 | - | |
52 | + | |
53 | +#if defined (HAVE_DECL_AUDIT_USER_TTY) | |
54 | +/* Report STRING to the audit system. */ | |
55 | +static void | |
56 | +audit_tty (char *string) | |
57 | +{ | |
58 | + struct sockaddr_nl addr; | |
59 | + struct msghdr msg; | |
60 | + struct nlmsghdr nlm; | |
61 | + struct iovec iov[2]; | |
62 | + size_t size; | |
63 | + int fd; | |
64 | + | |
65 | + size = strlen (string) + 1; | |
66 | + fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT); | |
67 | + if (fd < 0) | |
68 | + return; | |
69 | + nlm.nlmsg_len = NLMSG_LENGTH (size); | |
70 | + nlm.nlmsg_type = AUDIT_USER_TTY; | |
71 | + nlm.nlmsg_flags = NLM_F_REQUEST; | |
72 | + nlm.nlmsg_seq = 0; | |
73 | + nlm.nlmsg_pid = 0; | |
74 | + iov[0].iov_base = &nlm; | |
75 | + iov[0].iov_len = sizeof (nlm); | |
76 | + iov[1].iov_base = string; | |
77 | + iov[1].iov_len = size; | |
78 | + addr.nl_family = AF_NETLINK; | |
79 | + addr.nl_pad = 0; | |
80 | + addr.nl_pid = 0; | |
81 | + addr.nl_groups = 0; | |
82 | + msg.msg_name = &addr; | |
83 | + msg.msg_namelen = sizeof (addr); | |
84 | + msg.msg_iov = iov; | |
85 | + msg.msg_iovlen = 2; | |
86 | + msg.msg_control = NULL; | |
87 | + msg.msg_controllen = 0; | |
88 | + msg.msg_flags = 0; | |
89 | + (void)sendmsg (fd, &msg, 0); | |
90 | + close (fd); | |
91 | +} | |
92 | +#endif | |
93 | + | |
94 | /* Read a line of input. Prompt with PROMPT. An empty PROMPT means | |
95 | none. A return value of NULL means that EOF was encountered. */ | |
96 | char * |