Blame SOURCES/bash-5.0-syslog-history.patch

e6eb8e
diff --git a/bashhist.c b/bashhist.c
e6eb8e
index 9979f99..793c81f 100644
e6eb8e
--- a/bashhist.c
e6eb8e
+++ b/bashhist.c
e6eb8e
@@ -754,6 +754,12 @@ extern char *shell_name;
e6eb8e
 #define OPENLOG_OPTS 0
e6eb8e
 #endif
e6eb8e
 
e6eb8e
+#if defined (SYSLOG_SHOPT)
e6eb8e
+int syslog_history = SYSLOG_SHOPT;
e6eb8e
+#else
e6eb8e
+int syslog_history = 1;
e6eb8e
+#endif
e6eb8e
+
e6eb8e
 void
e6eb8e
 bash_syslog_history (line)
e6eb8e
      const char *line;
e6eb8e
@@ -851,7 +857,8 @@ bash_add_history (line)
e6eb8e
     really_add_history (line);
e6eb8e
 
e6eb8e
 #if defined (SYSLOG_HISTORY)
e6eb8e
-  bash_syslog_history (line);
e6eb8e
+  if (syslog_history)
e6eb8e
+    bash_syslog_history (line);
e6eb8e
 #endif
e6eb8e
 
e6eb8e
   using_history ();
e6eb8e
diff --git a/builtins/shopt.def b/builtins/shopt.def
e6eb8e
index 2febb7e..38c398e 100644
e6eb8e
--- a/builtins/shopt.def
e6eb8e
+++ b/builtins/shopt.def
e6eb8e
@@ -118,6 +118,10 @@ extern char *shell_name;
e6eb8e
 extern int debugging_mode;
e6eb8e
 #endif
e6eb8e
 
e6eb8e
+#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
e6eb8e
+extern int syslog_history;
e6eb8e
+#endif
e6eb8e
+
e6eb8e
 static void shopt_error __P((char *));
e6eb8e
 
e6eb8e
 static int set_shellopts_after_change __P((char *, int));
e6eb8e
@@ -223,6 +227,9 @@ static struct {
e6eb8e
 #endif
e6eb8e
   { "shift_verbose", &print_shift_error, (shopt_set_func_t *)NULL },
e6eb8e
   { "sourcepath", &source_uses_path, (shopt_set_func_t *)NULL },
e6eb8e
+#if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
e6eb8e
+  { "syslog_history", &syslog_history, (shopt_set_func_t *)NULL },
e6eb8e
+#endif
e6eb8e
   { "xpg_echo", &xpg_echo, (shopt_set_func_t *)NULL },
e6eb8e
   { (char *)0, (int *)0, (shopt_set_func_t *)NULL }
e6eb8e
 };
e6eb8e
diff --git a/config-top.h b/config-top.h
e6eb8e
index cb0e002..39cf6b5 100644
e6eb8e
--- a/config-top.h
e6eb8e
+++ b/config-top.h
e6eb8e
@@ -122,6 +122,13 @@
e6eb8e
 #  define OPENLOG_OPTS LOG_PID
e6eb8e
 #endif
e6eb8e
 
e6eb8e
+/* Define if you want syslogging history to be controllable at runtime via a
e6eb8e
+   shell option; if defined, the value is the default for the syslog_history
e6eb8e
+   shopt option */
e6eb8e
+#if defined (SYSLOG_HISTORY)
e6eb8e
+#define SYSLOG_SHOPT 0
e6eb8e
+#endif
e6eb8e
+
e6eb8e
 /* Define if you want to include code in shell.c to support wordexp(3) */
e6eb8e
 /* #define WORDEXP_OPTION */
e6eb8e
 
e6eb8e
diff --git a/doc/bash.1 b/doc/bash.1
e6eb8e
index d6cee1d..9dfa0b3 100644
e6eb8e
--- a/doc/bash.1
e6eb8e
+++ b/doc/bash.1
e6eb8e
@@ -9889,6 +9889,9 @@ If set, the
e6eb8e
 to find the directory containing the file supplied as an argument.
e6eb8e
 This option is enabled by default.
e6eb8e
 .TP 8
e6eb8e
+.B syslog_history
e6eb8e
+If set, command history is logged to syslog.
e6eb8e
+.TP 8
e6eb8e
 .B xpg_echo
e6eb8e
 If set, the \fBecho\fP builtin expands backslash-escape sequences
e6eb8e
 by default.