rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone
a9435e
diff --git a/bashhist.c b/bashhist.c
a9435e
--- a/bashhist.c
a9435e
+++ b/bashhist.c
a9435e
@@ -702,6 +702,12 @@ check_add_history (line, force)
a9435e
 #if defined (SYSLOG_HISTORY)
a9435e
 #define SYSLOG_MAXLEN 600
a9435e
a9435e
+#if defined (SYSLOG_SHOPT)
a9435e
+int syslog_history = SYSLOG_SHOPT;
a9435e
+#else
a9435e
+int syslog_history = 1;
a9435e
+#endif
a9435e
+
a9435e
 void
a9435e
 bash_syslog_history (line)
a9435e
      const char *line;
a9435e
@@ -782,7 +788,8 @@ bash_add_history (line)
a9435e
     really_add_history (line);
a9435e
a9435e
 #if defined (SYSLOG_HISTORY)
a9435e
-  bash_syslog_history (line);
a9435e
+  if (syslog_history)
a9435e
+    bash_syslog_history (line);
a9435e
 #endif
a9435e
a9435e
   using_history ();
a9435e
diff --git a/builtins/shopt.def b/builtins/shopt.def
a9435e
--- a/builtins/shopt.def
a9435e
+++ b/builtins/shopt.def
a9435e
@@ -115,6 +115,10 @@ extern char *shell_name;
a9435e
 extern int debugging_mode;
a9435e
 #endif
a9435e
a9435e
+#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
a9435e
+extern int syslog_history;
a9435e
+#endif
a9435e
+
a9435e
 static void shopt_error __P((char *));
a9435e
a9435e
 static int set_shellopts_after_change __P((char *, int));
a9435e
@@ -208,6 +212,9 @@ static struct {
a9435e
 #endif
a9435e
   { "shift_verbose", &print_shift_error, (shopt_set_func_t *)NULL },
a9435e
   { "sourcepath", &source_uses_path, (shopt_set_func_t *)NULL },
a9435e
+#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
a9435e
+  { "syslog_history", &syslog_history, (shopt_set_func_t *)NULL },
a9435e
+#endif
a9435e
   { "xpg_echo", &xpg_echo, (shopt_set_func_t *)NULL },
a9435e
   { (char *)0, (int *)0, (shopt_set_func_t *)NULL }
a9435e
 };
a9435e
diff --git a/config-top.h b/config-top.h
a9435e
--- a/config-top.h
a9435e
+++ b/config-top.h
a9435e
@@ -109,5 +109,12 @@
a9435e
 #  define SYSLOG_LEVEL LOG_INFO
a9435e
 #endif
a9435e
a9435e
+/* Define if you want syslogging history to be controllable at runtime via a
a9435e
+   shell option; if defined, the value is the default for the syslog_history
a9435e
+   shopt option */
a9435e
+#if defined (SYSLOG_HISTORY)
a9435e
+#define SYSLOG_SHOPT 0
a9435e
+#endif
a9435e
+
a9435e
 /* Define if you want to include code in shell.c to support wordexp(3) */
a9435e
 /* #define WORDEXP_OPTION */
a9435e
diff --git a/doc/bash.1 b/doc/bash.1
a9435e
--- a/doc/bash.1
a9435e
+++ b/doc/bash.1
a9435e
@@ -9224,6 +9224,9 @@ If set, the
a9435e
 to find the directory containing the file supplied as an argument.
a9435e
 This option is enabled by default.
a9435e
 .TP 8
a9435e
+.B syslog_history
a9435e
+If set, command history is logged to syslog.
a9435e
+.TP 8
a9435e
 .B xpg_echo
a9435e
 If set, the \fBecho\fP builtin expands backslash-escape sequences
a9435e
 by default.