summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2004-11-10 10:29:56 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2004-11-10 10:29:56 +0000
commit3d23590382767a12bc27fb9e5f1c546293cf84b5 (patch)
tree4d18f8afc789a5035030a8777bfe2226cefb1192 /src
parentb5c459685d7c2f5dca7e6d92be33c5932ece40b8 (diff)
Added -dd for daemon debugging.
Diffstat (limited to 'src')
-rw-r--r--src/ACKNOWLEDGMENTS5
-rw-r--r--src/src/daemon.c25
-rw-r--r--src/src/exim.c10
-rw-r--r--src/src/globals.c3
-rw-r--r--src/src/globals.h3
5 files changed, 37 insertions, 9 deletions
diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS
index 53b9a8025..b20e5e245 100644
--- a/src/ACKNOWLEDGMENTS
+++ b/src/ACKNOWLEDGMENTS
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.2 2004/10/19 11:40:52 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.3 2004/11/10 10:29:56 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -20,7 +20,7 @@ relatively small patches.
Philip Hazel
Lists created: 20 November 2002
-Last updated: 19 October 2004
+Last updated: 10 November 2004
THE OLD LIST
@@ -119,6 +119,7 @@ Tony Finch Expansion extensions
A number of useful code criticisms
Timezone patch for exiwhat
Patch for more daemon exiwhat information
+ Patch for -dd
Giuliano Gavazzi Patches for OSX compilation
Dominic Germain Patch for exiqgrep MacOS X bug
Oliver Gorwits $load_average patch
diff --git a/src/src/daemon.c b/src/src/daemon.c
index d9375eabf..19a8cea35 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/daemon.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
+/* $Cambridge: exim/src/src/daemon.c,v 1.2 2004/11/10 10:29:56 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -362,6 +362,7 @@ if (pid == 0)
int i;
int queue_only_reason = 0;
int old_pool = store_pool;
+ int save_debug_selector = debug_selector;
BOOL local_queue_only;
#ifdef SA_NOCLDWAIT
struct sigaction act;
@@ -432,15 +433,26 @@ if (pid == 0)
/* Attempt to get an id from the sending machine via the RFC 1413
protocol. We do this in the sub-process in order not to hold up the
main process if there is any delay. Then set up the fullhost information
- in case there is no HELO/EHLO. */
-
+ in case there is no HELO/EHLO.
+
+ If debugging is enabled only for the daemon, we must turn if off while
+ finding the id, but turn it on again afterwards so that information about the
+ incoming connection is output. */
+
+ if (debug_daemon) debug_selector = 0;
verify_get_ident(IDENT_PORT);
host_build_sender_fullhost();
+ debug_selector = save_debug_selector;
DEBUG(D_any)
debug_printf("Process %d is handling incoming connection from %s\n",
(int)getpid(), sender_fullhost);
+ /* Now disable debugging permanently if it's required only for the daemon
+ process. */
+
+ if (debug_daemon) debug_selector = 0;
+
/* If there are too many child processes for immediate delivery,
set the local_queue_only flag, which is initialized from the
configured value and may therefore already be TRUE. Leave logging
@@ -1511,9 +1523,16 @@ for (;;)
if ((pid = fork()) == 0)
{
int sk;
+
DEBUG(D_any) debug_printf("Starting queue-runner: pid %d\n",
(int)getpid());
+ /* Disable debugging if it's required only for the daemon process. We
+ leave the above message, because it ties up with the "child ended"
+ debugging messages. */
+
+ if (debug_daemon) debug_selector = 0;
+
/* Close any open listening sockets in the child */
for (sk = 0; sk < listen_socket_count; sk++) close(listen_sockets[sk]);
diff --git a/src/src/exim.c b/src/src/exim.c
index e22fd2308..6664ea214 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/exim.c,v 1.7 2004/11/04 12:19:48 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim.c,v 1.8 2004/11/10 10:29:56 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1863,7 +1863,8 @@ for (i = 1; i < argc; i++)
break;
/* -d: Set debug level (see also -v below) or set the drop_cr option.
- The latter is now a no-opt, retained for compatibility only. */
+ The latter is now a no-op, retained for compatibility only. If -dd is used,
+ debugging subprocesses of the daemon is disabled. */
case 'd':
if (Ustrcmp(argrest, "ropcr") == 0)
@@ -1879,6 +1880,11 @@ for (i = 1; i < argc; i++)
unsigned int selector = D_default;
debug_selector = 0;
debug_file = NULL;
+ if (*argrest == 'd')
+ {
+ debug_daemon = TRUE;
+ argrest++;
+ }
if (*argrest != 0)
decode_bits(&selector, NULL, argrest, debug_options,
debug_options_count, US"debug");
diff --git a/src/src/globals.c b/src/src/globals.c
index 0794e03f9..3ea8d7d20 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.5 2004/11/05 16:53:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.6 2004/11/10 10:29:56 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -363,6 +363,7 @@ uschar *continue_transport = NULL;
BOOL daemon_listen = FALSE;
uschar *daemon_smtp_port = US"smtp";
+BOOL debug_daemon = FALSE;
int debug_fd = -1;
FILE *debug_file = NULL;
bit_table debug_options[] = {
diff --git a/src/src/globals.h b/src/src/globals.h
index eaf192e66..59154403e 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.5 2004/11/05 16:53:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.6 2004/11/10 10:29:56 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -194,6 +194,7 @@ extern uschar *continue_transport; /* Transport for continued delivery */
extern BOOL daemon_listen; /* True if listening required */
extern uschar *daemon_smtp_port; /* Can be a list of ports */
+extern BOOL debug_daemon; /* Debug the daemon process only */
extern int debug_fd; /* The fd for debug_file */
extern FILE *debug_file; /* Where to write debugging info */
extern bit_table debug_options[]; /* Table of debug options */