X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/520de300979cb6cf448cd23f729dd39368202a16..24796b8d20edd438ff520630d4cf4a39d94dcada:/src/src/daemon.c diff --git a/src/src/daemon.c b/src/src/daemon.c index 797a51c20..1e639453c 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/daemon.c,v 1.17 2006/11/06 11:27:54 ph10 Exp $ */ +/* $Cambridge: exim/src/src/daemon.c,v 1.21 2007/01/17 11:29:39 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2006 */ +/* Copyright (c) University of Cambridge 1995 - 2007 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with running Exim as a daemon */ @@ -468,7 +468,12 @@ if (pid == 0) /* Handle the start of the SMTP session, then loop, accepting incoming messages from the SMTP connection. The end will come at the QUIT command, when smtp_setup_msg() returns 0. A break in the connection causes the - process to die (see accept.c). */ + process to die (see accept.c). + + NOTE: We do *not* call smtp_log_no_mail() if smtp_start_session() fails, + because a log line has already been written for all its failure exists + (usually "connection refused: ") and writing another one is + unnecessary clutter. */ if (!smtp_start_session()) { @@ -500,6 +505,7 @@ if (pid == 0) if (!ok) /* Connection was dropped */ { mac_smtp_fflush(); + smtp_log_no_mail(); /* Log no mail if configured */ _exit(EXIT_SUCCESS); } if (message_id[0] == 0) continue; /* No message was accepted */ @@ -508,6 +514,7 @@ if (pid == 0) { mac_smtp_fflush(); search_tidyup(); + smtp_log_no_mail(); /* Log no mail if configured */ _exit((rc == 0)? EXIT_SUCCESS : EXIT_FAILURE); } @@ -1629,6 +1636,8 @@ for (;;) { uschar opt[8]; uschar *p = opt; + uschar *extra[4]; + int extracount = 1; signal(SIGALRM, SIG_DFL); *p++ = '-'; @@ -1639,8 +1648,29 @@ for (;;) if (deliver_force_thaw) *p++ = 'f'; if (queue_run_local) *p++ = 'l'; *p = 0; + extra[0] = opt; + + /* If -R or -S were on the original command line, ensure they get + passed on. */ + + if (deliver_selectstring != NULL) + { + extra[extracount++] = deliver_selectstring_regex? US"-Rr" : US"-R"; + extra[extracount++] = deliver_selectstring; + } + + if (deliver_selectstring_sender != NULL) + { + extra[extracount++] = deliver_selectstring_sender_regex? + US"-Sr" : US"-S"; + extra[extracount++] = deliver_selectstring_sender; + } + + /* Overlay this process with a new execution. */ + + (void)child_exec_exim(CEE_EXEC_PANIC, FALSE, NULL, TRUE, extracount, + extra[0], extra[1], extra[2], extra[3], extra[4]); - (void)child_exec_exim(CEE_EXEC_PANIC, FALSE, NULL, TRUE, 1, opt); /* Control never returns here. */ }