1 |
vapier 09/02/24 22:13:10 |
2 |
|
3 |
Modified: bash-3.1-bash-logger.patch |
4 |
Log: |
5 |
touch up style a bit |
6 |
|
7 |
Revision Changes Path |
8 |
1.3 app-shells/bash/files/bash-3.1-bash-logger.patch |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-shells/bash/files/bash-3.1-bash-logger.patch?rev=1.3&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-shells/bash/files/bash-3.1-bash-logger.patch?rev=1.3&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-shells/bash/files/bash-3.1-bash-logger.patch?r1=1.2&r2=1.3 |
13 |
|
14 |
Index: bash-3.1-bash-logger.patch |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/app-shells/bash/files/bash-3.1-bash-logger.patch,v |
17 |
retrieving revision 1.2 |
18 |
retrieving revision 1.3 |
19 |
diff -u -r1.2 -r1.3 |
20 |
--- bash-3.1-bash-logger.patch 16 Jul 2006 03:54:20 -0000 1.2 |
21 |
+++ bash-3.1-bash-logger.patch 24 Feb 2009 22:13:10 -0000 1.3 |
22 |
@@ -1,7 +1,7 @@ |
23 |
Add support for logging bash commands via syslog(). |
24 |
Useful for deploying in honeypot environments. |
25 |
|
26 |
-http://bugs.gentoo.org/show_bug.cgi?id=91327 |
27 |
+http://bugs.gentoo.org/91327 |
28 |
http://www.nardware.co.uk/Security/html/bashlogger.htm |
29 |
|
30 |
--- bashhist.c |
31 |
@@ -35,7 +35,7 @@ |
32 |
if (HIST_TIMESTAMP_START(line_start) == 0) |
33 |
{ |
34 |
- add_history (line_start); |
35 |
-+ add_history (line_start,0); |
36 |
++ add_history (line_start, 0); |
37 |
if (last_ts) |
38 |
{ |
39 |
add_history_time (last_ts); |
40 |
@@ -50,7 +50,7 @@ |
41 |
#if defined (HAVE_STDLIB_H) |
42 |
# include <stdlib.h> |
43 |
#else |
44 |
-@@ -246,10 +250,24 @@ |
45 |
+@@ -246,10 +250,23 @@ |
46 |
/* Place STRING at the end of the history list. The data field |
47 |
is set to NULL. */ |
48 |
void |
49 |
@@ -62,16 +62,15 @@ |
50 |
{ |
51 |
HIST_ENTRY *temp; |
52 |
+ if (logme) { |
53 |
-+ if (strlen(string)<600) { |
54 |
++ char trunc[600]; /* arbitrary max size of 600 bytes */ |
55 |
++ if (strlen(string) < sizeof(trunc)) { |
56 |
+ syslog(LOG_LOCAL5 | LOG_INFO, "HISTORY: PID=%d UID=%d %s", |
57 |
+ getpid(), getuid(), string); |
58 |
-+ } |
59 |
-+ else { |
60 |
-+ char trunc[600]; |
61 |
-+ strncpy(trunc,string,sizeof(trunc)); |
62 |
-+ trunc[sizeof(trunc)-1]='\0'; |
63 |
++ } else { |
64 |
++ memcpy(trunc, string, sizeof(trunc)); |
65 |
++ trunc[sizeof(trunc) - 1] = '\0'; |
66 |
+ syslog(LOG_LOCAL5 | LOG_INFO, "HISTORY: PID=%d UID=%d %s(++TRUNC)", |
67 |
-+ getpid(), getuid(), trunc); |
68 |
++ getpid(), getuid(), trunc); |
69 |
+ } |
70 |
+ } |