[Exim] exim patch :: additional log option

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: philipp
Dátum:  
Címzett: ph10
CC: exim-users
Tárgy: [Exim] exim patch :: additional log option
Hi Philip,

please find attached a quick patch which adds a new log option "working_directory".
This would print out the current working directory to the Log.

In combination with logging arguments, this shows extremly handy, if exim is running on a virtual webserver box, and you are trying to find out which site has a buggy mailform, which is used to send out spam.

I eventually just copied your code, probably not exactly knowing what I am doing...
Currently it will still print out a line for (nearly) every call to exim,
although this should obviously only be printed if exim is called for a locally generated
message.
I tried to use "sender_local", but it wouldn't work as expected - but I'm sure you'd know how to?!

I'd be happy to see this in future releases of exim.

keep up the great work!

best

Philipp

--
CORPEX - The Business Internet Company * http://www.corpex.de * info@???
Corpex Internet GmbH * Pressehaus, Curienstraße 1 * 20095 Hamburg * Germany
Tel: <040> 822 268 0 * Fax: <040> 822 268 100

(x)Hosting (x)Housing (x)Anti Virus (x)Weblication Development (x)ASP

>>  CORPEX in London:   +44 207 430 8000    -    http://www.corpex.com  <<





======

diff -urN exim-4.14.orig/src/exim.c exim-4.14.patched/src/exim.c
--- exim-4.14.orig/src/exim.c    Tue Mar 11 13:20:20 2003
+++ exim-4.14.patched/src/exim.c    Fri Mar 14 01:21:09 2003


}
#endif /* EXIM_PERL */

+/* Log the current working directory of the call if the configuration file said
+so. This is a debugging feature if exim is installed on a webserver and one is
+trying to find sites which are being abused by mailform bugs, etc. */
+
+if ((log_selector & L_working_directory) != 0 && really_exim && !list_variables &&
+     !checking && !daemon_listen)
+  {
+  uschar *p = big_buffer;
+  int i = sprintf(CS big_buffer, "current working directory: ");
+  p += i;
+
+  if( (getcwd(p, sizeof(big_buffer) - (i * sizeof(uschar)) )) != NULL)
+    {
+    log_write(0, LOG_MAIN, "%s", big_buffer);
+    }
+  }
+
+
 /* Set the working directory to be the top-level spool directory. We don't rely
 on this in the code, which always uses fully qualified names, but it's useful
 for core dumps etc. Don't complain if it fails - the spool directory might not
diff -urN exim-4.14.orig/src/globals.c exim-4.14.patched/src/globals.c
--- exim-4.14.orig/src/globals.c    Tue Mar 11 13:20:20 2003
+++ exim-4.14.patched/src/globals.c    Fri Mar 14 01:21:09 2003


   { US"smtp_syntax_error",            L_smtp_syntax_error },
   { US"subject",                      L_subject },
   { US"tls_cipher",                   L_tls_cipher },
-  { US"tls_peerdn",                   L_tls_peerdn }
+  { US"tls_peerdn",                   L_tls_peerdn },
+  { US"working_directory",            L_working_directory }
 };


 int     log_options_count      = sizeof(log_options)/sizeof(bit_table);
diff -urN exim-4.14.orig/src/macros.h exim-4.14.patched/src/macros.h
--- exim-4.14.orig/src/macros.h    Tue Mar 11 13:20:21 2003
+++ exim-4.14.patched/src/macros.h    Fri Mar 14 01:21:09 2003


 #define L_subject                    0x01000000
 #define L_tls_cipher                 0x02000000
 #define L_tls_peerdn                 0x04000000
+#define L_working_directory          0x08000000


 #define L_all                        0xffffffff
 #define L_default                    (L_connection_reject        | \