RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: bash                             Date:   09-May-2009 18:33:27
  Branch: HEAD                             Handle: 2009050916332600

  Modified files:
    bash                    config.h.in configure.in
    bash/lib/readline       readline.c

  Log:
    - jbj: apply bash-3.2-audit.patch.

  Summary:
    Revision    Changes     Path
    1.4         +8  -0      bash/config.h.in
    1.3         +2  -0      bash/configure.in
    1.3         +52 -1      bash/lib/readline/readline.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: bash/config.h.in
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 config.h.in
  --- bash/config.h.in  9 May 2009 16:29:52 -0000       1.3
  +++ bash/config.h.in  9 May 2009 16:33:26 -0000       1.4
  @@ -1084,6 +1084,14 @@
   
   /* End additions for lib/intl */
   
  +
  +/* Additions for lib/readline */
  +
  +/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
  +#undef HAVE_DECL_AUDIT_USER_TTY
  +
  +/* End additions for lib/readline */
  +
   #include "config-bot.h"
   
   #endif /* _CONFIG_H_ */
  @@ .
  patch -p0 <<'@@ .'
  Index: bash/configure.in
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 configure.in
  --- bash/configure.in 9 May 2009 16:29:52 -0000       1.2
  +++ bash/configure.in 9 May 2009 16:33:26 -0000       1.3
  @@ -878,6 +878,8 @@
   BASH_SYS_PGRP_SYNC
   BASH_SYS_SIGNAL_VINTAGE
   
  +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
  +
   dnl checking for the presence of certain library symbols
   BASH_SYS_ERRLIST
   BASH_SYS_SIGLIST
  @@ .
  patch -p0 <<'@@ .'
  Index: bash/lib/readline/readline.c
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 readline.c
  --- bash/lib/readline/readline.c      9 May 2009 16:32:25 -0000       1.2
  +++ bash/lib/readline/readline.c      9 May 2009 16:33:26 -0000       1.3
  @@ -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"
  @@ -297,7 +303,47 @@
     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 *
  @@ -348,6 +394,11 @@
       RL_SETSTATE (RL_STATE_CALLBACK);
   #endif
   
  +#if defined (HAVE_DECL_AUDIT_USER_TTY)
  +  if (value != NULL)
  +    audit_tty (value);
  +#endif
  +
     return (value);
   }
   
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to