nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone

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

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