- include patches 001, 002 (#657758)
- add TTY input audit support (#244350)
This commit is contained in:
Miroslav Lichvar 2011-01-18 16:35:53 +01:00
parent 4133c3df95
commit bdaa6c0962
5 changed files with 237 additions and 32 deletions

116
readline-6.1-audit.patch Normal file
View File

@ -0,0 +1,116 @@
diff -up readline-6.1/config.h.in.audit readline-6.1/config.h.in
--- readline-6.1/config.h.in.audit 2009-03-10 15:57:45.000000000 +0100
+++ readline-6.1/config.h.in 2011-01-18 15:14:51.199219895 +0100
@@ -29,6 +29,9 @@
#undef __CHAR_UNSIGNED__
+/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
+#undef HAVE_DECL_AUDIT_USER_TTY
+
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
diff -up readline-6.1/configure.audit readline-6.1/configure
--- readline-6.1/configure.audit 2009-12-29 23:33:49.000000000 +0100
+++ readline-6.1/configure 2011-01-18 15:21:20.571330373 +0100
@@ -6602,7 +6602,9 @@ _ACEOF
fi
-
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_AUDIT_USER_TTY 1
+_ACEOF
{ $as_echo "$as_me:$LINENO: checking if signal handlers must be reinstalled when invoked" >&5
$as_echo_n "checking if signal handlers must be reinstalled when invoked... " >&6; }
diff -up readline-6.1/configure.in.audit readline-6.1/configure.in
--- readline-6.1/configure.in.audit 2009-10-12 16:12:15.000000000 +0200
+++ readline-6.1/configure.in 2011-01-18 15:14:51.199219895 +0100
@@ -159,6 +159,8 @@ AC_CHECK_HEADERS(sys/ptem.h,,,
AC_SYS_LARGEFILE
+AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
+
BASH_SYS_SIGNAL_VINTAGE
BASH_SYS_REINSTALL_SIGHANDLERS
diff -up readline-6.1/readline.c.audit readline-6.1/readline.c
--- readline-6.1/readline.c.audit 2009-08-31 14:45:31.000000000 +0200
+++ readline-6.1/readline.c 2011-01-18 15:14:51.200219841 +0100
@@ -55,6 +55,12 @@
extern int errno;
#endif /* !errno */
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
+# include <sys/socket.h>
+# include <linux/audit.h>
+# include <linux/netlink.h>
+#endif
+
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "rlmbutil.h"
@@ -301,7 +307,47 @@ rl_set_prompt (prompt)
rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
return 0;
}
-
+
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
+/* Report STRING to the audit system. */
+static void
+audit_tty (char *string)
+{
+ struct sockaddr_nl addr;
+ struct msghdr msg;
+ struct nlmsghdr nlm;
+ struct iovec iov[2];
+ size_t size;
+ int fd;
+
+ size = strlen (string) + 1;
+ fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
+ if (fd < 0)
+ return;
+ nlm.nlmsg_len = NLMSG_LENGTH (size);
+ nlm.nlmsg_type = AUDIT_USER_TTY;
+ nlm.nlmsg_flags = NLM_F_REQUEST;
+ nlm.nlmsg_seq = 0;
+ nlm.nlmsg_pid = 0;
+ iov[0].iov_base = &nlm;
+ iov[0].iov_len = sizeof (nlm);
+ iov[1].iov_base = string;
+ iov[1].iov_len = size;
+ addr.nl_family = AF_NETLINK;
+ addr.nl_pid = 0;
+ addr.nl_groups = 0;
+ msg.msg_name = &addr;
+ msg.msg_namelen = sizeof (addr);
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 2;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
+ (void)sendmsg (fd, &msg, 0);
+ close (fd);
+}
+#endif
+
/* Read a line of input. Prompt with PROMPT. An empty PROMPT means
none. A return value of NULL means that EOF was encountered. */
char *
@@ -352,6 +398,11 @@ readline (prompt)
RL_SETSTATE (RL_STATE_CALLBACK);
#endif
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
+ if (value != NULL)
+ audit_tty (value);
+#endif
+
return (value);
}

View File

@ -1,28 +0,0 @@
From 0415e19a3f41596800e6144a5c5acca05929a90a Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 17 Feb 2010 21:15:01 +0100
Subject: [PATCH] Fix the version number
---
readline.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/readline.h b/readline.h
index 7a4ffaa..9a9e18a 100644
--- a/readline.h
+++ b/readline.h
@@ -39,9 +39,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
-#define RL_READLINE_VERSION 0x0600 /* Readline 6.0 */
+#define RL_READLINE_VERSION 0x0601 /* Readline 6.0 */
#define RL_VERSION_MAJOR 6
-#define RL_VERSION_MINOR 0
+#define RL_VERSION_MINOR 1
/* Readline data structures. */
--
1.7.0

View File

@ -1,15 +1,18 @@
Summary: A library for editing typed command lines
Name: readline
Version: 6.1
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Libraries
URL: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Source: ftp://ftp.gnu.org/gnu/readline/readline-%{version}.tar.gz
# sent upstream
Patch0: readline-6.1-version.patch
# upstream patches
Patch1: readline61-001
Patch2: readline61-002
# fix file permissions, remove RPATH, use CFLAGS
Patch20: readline-6.1-shlib.patch
# add TTY input audit support
Patch21: readline-6.1-audit.patch
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
BuildRequires: ncurses-devel
@ -48,8 +51,10 @@ library.
%prep
%setup -q
%patch0 -p1 -b .version
%patch1 -p0
%patch2 -p0
%patch20 -p1 -b .shlib
%patch21 -p1 -b .audit
pushd examples
rm -f rlfe/configure
@ -127,6 +132,10 @@ fi
%{_libdir}/lib*.a
%changelog
* Tue Jan 18 2011 Miroslav Lichvar <mlichvar@redhat.com> 6.1-3
- include patches 001, 002 (#657758)
- add TTY input audit support (#244350)
* Wed Feb 17 2010 Lubomir Rintel <lkundrak@v3.sk> 6.1-2
- fix the version number in header

61
readline61-001 Normal file
View File

@ -0,0 +1,61 @@
READLINE PATCH REPORT
=====================
Readline-Release: 6.1
Patch-ID: readline61-001
Bug-Reported-by: guillaume.outters@free.fr
Bug-Reference-ID: <20100105230441.70D171AA7F52@asterix.local>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2010-01/msg00017.html
Bug-Description:
Bash-4.1/Readline-6.1 introduced a hook function that allows applications
to rewrite or modify filenames read from the file system before comparing
them with a word to be completed. The converted filename, if it matches,
needs to be inserted into the line buffer, replacing the original contents.
This fixes a completion bug on Mac OS X involving filenames containing
UTF-8 characters.
Patch (apply with `patch -p0'):
*** ../readline-6.1-patched/complete.c 2009-11-29 18:39:30.000000000 -0500
--- complete.c 2010-01-06 08:30:23.000000000 -0500
***************
*** 2139,2143 ****
if (filename_len == 0)
{
! if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
continue;
--- 2139,2143 ----
if (filename_len == 0)
{
! if (_rl_match_hidden_files == 0 && HIDDEN_FILE (convfn))
continue;
***************
*** 2220,2224 ****
}
! strcpy (temp + dirlen, entry->d_name);
}
else
--- 2220,2224 ----
}
! strcpy (temp + dirlen, convfn);
}
else
*** ../readline-6.1-patched/patchlevel 2008-11-18 11:01:14.000000000 -0500
--- patchlevel 2010-01-14 10:15:52.000000000 -0500
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 0
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 1

47
readline61-002 Normal file
View File

@ -0,0 +1,47 @@
READLINE PATCH REPORT
=====================
Readline-Release: 6.1
Patch-ID: readline61-002
Bug-Reported-by: Chet Ramey <chet.ramey@case.edu>
Bug-Reference-ID:
Bug-Reference-URL:
Bug-Description:
The readline version information was not updated for the release of version 6.1.
Patch (apply with `patch -p0'):
*** ../readline-6.1-patched/readline.h 2009-08-26 23:05:55.000000000 -0400
--- readline.h 2010-01-26 10:42:42.000000000 -0500
***************
*** 40,46 ****
/* Hex-encoded Readline version number. */
! #define RL_READLINE_VERSION 0x0600 /* Readline 6.0 */
#define RL_VERSION_MAJOR 6
! #define RL_VERSION_MINOR 0
/* Readline data structures. */
--- 40,46 ----
/* Hex-encoded Readline version number. */
! #define RL_READLINE_VERSION 0x0601 /* Readline 6.1 */
#define RL_VERSION_MAJOR 6
! #define RL_VERSION_MINOR 1
/* Readline data structures. */
*** ../readline-6.1-patched/patchlevel 2008-11-18 11:01:14.000000000 -0500
--- patchlevel 2010-01-14 10:15:52.000000000 -0500
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 1
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 2