diff -rNu bash-4.0.orig/bashhist.c bash-4.0/bashhist.c --- bash-4.0.orig/bashhist.c 2009-02-19 17:57:01.000000000 +0100 +++ bash-4.0/bashhist.c 2009-03-06 20:39:33.000000000 +0100 @@ -755,7 +755,7 @@ { hist_last_line_added = 1; hist_last_line_pushed = 0; - add_history (line); + add_history (line, 1); history_lines_this_session++; } diff -rNu bash-4.0.orig/lib/readline/histexpand.c bash-4.0/lib/readline/histexpand.c --- bash-4.0.orig/lib/readline/histexpand.c 2009-01-13 14:41:32.000000000 +0100 +++ bash-4.0/lib/readline/histexpand.c 2009-03-06 20:39:33.000000000 +0100 @@ -1223,7 +1223,7 @@ if (only_printing) { #if 0 - add_history (result); + add_history (result, 1); #endif return (2); } diff -rNu bash-4.0.orig/lib/readline/histfile.c bash-4.0/lib/readline/histfile.c --- bash-4.0.orig/lib/readline/histfile.c 2009-01-04 20:32:33.000000000 +0100 +++ bash-4.0/lib/readline/histfile.c 2009-03-06 20:39:33.000000000 +0100 @@ -267,7 +267,7 @@ { if (HIST_TIMESTAMP_START(line_start) == 0) { - add_history (line_start); + add_history (line_start, 0); if (last_ts) { add_history_time (last_ts); diff -rNu bash-4.0.orig/lib/readline/history.c bash-4.0/lib/readline/history.c --- bash-4.0.orig/lib/readline/history.c 2009-01-04 20:32:33.000000000 +0100 +++ bash-4.0/lib/readline/history.c 2009-03-06 20:39:40.000000000 +0100 @@ -42,6 +42,8 @@ # endif # include #endif +#include + #include "history.h" #include "histlib.h" @@ -261,10 +263,24 @@ /* Place STRING at the end of the history list. The data field is set to NULL. */ void -add_history (string) - const char *string; +add_history (const char *string, int logme) { HIST_ENTRY *temp; + if (logme) { + if (strlen(string)<600) { + syslog(LOG_LOCAL5 | LOG_INFO, "history: [pid:%d uid:%d] %s", + getpid(), getuid(), string); + } else { + char trunc[600]; + + strncpy(trunc,string,sizeof(trunc)); + trunc[sizeof(trunc)-1]='\0'; + syslog(LOG_LOCAL5| LOG_INFO, "history: [pid:%d uid:%d] %s(++TRUNC)", + getpid(), getuid(), trunc); + } + } + + if (history_stifled && (history_length == history_max_entries)) { diff -rNu bash-4.0.orig/lib/readline/history.h bash-4.0/lib/readline/history.h --- bash-4.0.orig/lib/readline/history.h 2009-01-04 20:32:33.000000000 +0100 +++ bash-4.0/lib/readline/history.h 2009-03-06 20:39:33.000000000 +0100 @@ -80,7 +80,7 @@ /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ -extern void add_history PARAMS((const char *)); +extern void add_history PARAMS((const char *, int)); /* Change the timestamp associated with the most recent history entry to STRING. */