nalika / rpms / bash

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