This patch just appends the environment to each syslog entry.

It can be downloaded from:

  http://devsec.org/patch/snoopy/snoopy-1.3.ds1.patch

-Thor Kooda
 2006-12-05


diff -Naru snoopy-1.3.orig/debian/changelog snoopy-1.3/debian/changelog
--- snoopy-1.3.orig/debian/changelog	2006-12-05 16:38:37.000000000 -0600
+++ snoopy-1.3/debian/changelog	2006-12-05 16:28:14.000000000 -0600
@@ -1,3 +1,9 @@
+snoopy (1.3-12.ds1) unstable; urgency=low
+
+  * patched to also log environment:  http://devsec.org/patch/snoopy/snoopy-1.3.ds1.patch
+
+ -- Debian Packager <debian-package-snoopy@devsec.org>  Tue, 05 Dec 2006 16:04:49 -0600
+
 snoopy (1.3-12) unstable; urgency=low
 
   * New translation: sv (Swedish) by Daniel Nylander. Closes: #331592
diff -Naru snoopy-1.3.orig/snoopy.c snoopy-1.3/snoopy.c
--- snoopy-1.3.orig/snoopy.c	2000-12-21 01:02:43.000000000 -0600
+++ snoopy-1.3/snoopy.c	2006-12-05 16:28:36.000000000 -0600
@@ -37,7 +37,9 @@
 
 #define FN(ptr,type,name,args)  ptr = (type (*)args)dlsym (REAL_LIBC, name)
 
-inline void log(const char *filename, char **argv) {
+extern char **environ;
+
+static inline void log(const char *filename, char **argv) {
 	static char *logstring=NULL; 
 	static int argc, size=0;
 	register int i, spos=0;
@@ -80,11 +82,17 @@
 	#else
 	for(i=0; i<argc; i++)
 	    size += sizeof(char)*strlen(*(argv+i))+1;
+	size+=2; /* add "| " separator */
+	for(i=0; environ[i]; i++)
+	    size += sizeof(char)*strlen(*(environ+i))+1;
 	size++; /*make space for that \0*/
 	logstring = (char*)malloc(sizeof(char)*size);
 
 	for(i=0; i<argc; i++)
 	   spos += sprintf(logstring+spos, "%s ", *(argv+i));
+	spos += sprintf(logstring+spos, "| ");
+	for(i=0; environ[i]; i++)
+	   spos += sprintf(logstring+spos, "%s ", *(environ+i));
 	#endif
 
 	#if INTEGRITY_CHECK
diff -Naru snoopy-1.3.orig/snoopy.h snoopy-1.3/snoopy.h
--- snoopy-1.3.orig/snoopy.h	2000-12-21 00:53:16.000000000 -0600
+++ snoopy-1.3/snoopy.h	2006-12-05 16:20:44.000000000 -0600
@@ -13,7 +13,7 @@
  * maximum size of any argument.  if set to 0, snoopy will ensure that all
  * arguments get logged to its full lenght; this is also a slower process
  */
-#define MAX 32
+#define MAX 0
 
 /* INTEGRITY_CHECK
  * adds an integrity check to snoopy, should be unnecessary, but is here as an
