[exim-cvs] Call notquite ACL for synprot-error limit. Bug 3…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] Call notquite ACL for synprot-error limit. Bug 3092
Gitweb: https://git.exim.org/exim.git/commitdiff/ee549a2ed04164407f4f897be3bf545f32579c5c
Commit:     ee549a2ed04164407f4f897be3bf545f32579c5c
Parent:     a1ebfb2e46e13ee87afc91856a4af38175735d74
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Dec 12 16:16:28 2024 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Dec 12 16:16:28 2024 +0000


    Call notquite ACL for synprot-error limit.  Bug 3092
---
 doc/doc-txt/ChangeLog |   3 ++
 src/src/daemon.c      |  37 ++++++++--------
 src/src/functions.h   |   2 +-
 src/src/globals.c     |   2 +-
 src/src/globals.h     |   2 +-
 src/src/receive.c     |  36 +++++++++-------
 src/src/smtp_in.c     | 114 ++++++++++++++++++++++++++++++++------------------
 src/src/structs.h     |   2 +-
 src/src/tls-gnu.c     |   6 +++
 src/src/tls-openssl.c |   4 +-
 test/log/0901         |   1 -
 test/stderr/0022      |   3 ++
 test/stderr/0044      |   2 +
 test/stderr/0275      |   1 +
 test/stderr/0278      |   1 +
 test/stderr/0294      |   2 +
 test/stderr/0303      |   2 +
 test/stderr/0317      |   2 +
 test/stderr/0361      |   1 +
 test/stderr/0371      |   1 +
 test/stderr/0386      |   2 +
 test/stderr/0402      |   1 +
 test/stderr/0403      |   2 +
 test/stderr/0408      |   1 +
 test/stderr/0465      |   2 +
 test/stderr/0471      |   6 +++
 test/stderr/0487      |   1 +
 test/stderr/0489      |   8 ++++
 test/stderr/0575      |   1 +
 test/stderr/0628      |   2 +
 test/stderr/2202      |   1 +
 test/stderr/2600      |   1 +
 test/stderr/2610      |   1 +
 test/stderr/2620      |   1 +
 test/stderr/4155      |   2 +
 test/stderr/5004      |   1 +
 test/stderr/5005      |   4 ++
 test/stderr/5006      |   1 +
 38 files changed, 183 insertions(+), 79 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 395ed4ada..d3820946e 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -93,6 +93,9 @@ JH/17 Bug 3126: Fix build error in the ibase lookup.  Find & fix by
 JH/18 Bug 3102: The dmarc_tld_file and dmarc_history_file options are now
       expanded before use.


+JH/19 Bug 3092: Call acl_smtp_notquit for drops associated with the
+      smtp_max_synprot_errors limit.
+
 Exim version 4.98
 -----------------


diff --git a/src/src/daemon.c b/src/src/daemon.c
index e68d4dba1..8d2dfa7e2 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -554,25 +554,13 @@ if (pid == 0)

     /* Smtp_setup_msg() returns 0 on QUIT or if the call is from an
     unacceptable host or if an ACL "drop" command was triggered, -1 on
-    connection lost, and +1 on validly reaching DATA. Receive_msg() almost
-    always returns TRUE when smtp_input is true; just retry if no message was
-    accepted (can happen for invalid message parameters). However, it can yield
-    FALSE if the connection was forcibly dropped by the DATA ACL. */
+    connection lost or synprot-error, and +1 on validly reaching DATA.
+    Receive_msg() almost always returns TRUE when smtp_input is true; just retry
+    if no message was accepted (can happen for invalid message parameters).
+    However, it can yield FALSE if the connection was forcibly dropped by the
+    DATA ACL. */


-    if ((rc = smtp_setup_msg()) > 0)
-      {
-      BOOL ok = receive_msg(FALSE);
-      search_tidyup();                    /* Close cached databases */
-      if (!ok)                            /* Connection was dropped */
-        {
-    cancel_cutthrough_connection(TRUE, US"receive dropped");
-        mac_smtp_fflush();
-        smtp_log_no_mail();               /* Log no mail if configured */
-        exim_underbar_exit(EXIT_SUCCESS);
-        }
-      if (!message_id[0]) continue;    /* No message was accepted */
-      }
-    else                /* bad smtp_setup_msg() */
+    if ((rc = smtp_setup_msg()) <= 0)        /* bad smtp_setup_msg() */
       {
       if (smtp_out)
     {
@@ -594,6 +582,19 @@ if (pid == 0)
       exim_underbar_exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
       }


+     {
+      BOOL ok = receive_msg(FALSE);
+      search_tidyup();                    /* Close cached databases */
+      if (!ok)                            /* Connection was dropped */
+        {
+    cancel_cutthrough_connection(TRUE, US"receive dropped");
+        mac_smtp_fflush();
+        smtp_log_no_mail();               /* Log no mail if configured */
+        exim_underbar_exit(EXIT_SUCCESS);
+        }
+      if (!message_id[0]) continue;    /* No message was accepted */
+     }
+
     /* Show the recipients when debugging */


     DEBUG(D_receive)
diff --git a/src/src/functions.h b/src/src/functions.h
index 74000b92f..ed33018b9 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -506,7 +506,7 @@ extern BOOL    smtp_hasc(void);
 extern int     smtp_handle_acl_fail(int, int, uschar *, uschar *);
 extern void    smtp_log_no_mail(void);
 extern void    smtp_message_code(uschar **, int *, uschar **, uschar **, BOOL);
-extern void    smtp_notquit_exit(uschar *, uschar *, uschar *, ...);
+extern void    smtp_notquit_exit(const uschar *, uschar *, const uschar *, ...);
 extern void    smtp_port_for_connect(host_item *, int);
 extern void    smtp_proxy_tls(void *, uschar *, size_t, int *, int, const uschar *) NORETURN;
 extern BOOL    smtp_read_response(void *, uschar *, int, int, int);
diff --git a/src/src/globals.c b/src/src/globals.c
index 8373c1e7d..ca2979d40 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1440,7 +1440,7 @@ FILE   *smtp_out               = NULL;
 uschar *smtp_etrn_command      = NULL;
 int     smtp_max_synprot_errors= 3;
 int     smtp_max_unknown_commands = 3;
-uschar *smtp_notquit_reason    = NULL;
+const uschar *smtp_notquit_reason = NULL;
 unsigned smtp_peer_options     = 0;
 unsigned smtp_peer_options_wrap= 0;
 uschar *smtp_ratelimit_hosts   = NULL;
diff --git a/src/src/globals.h b/src/src/globals.h
index 0487f69a7..3f1ae259a 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -989,7 +989,7 @@ extern int     smtp_mailcmd_max;       /* Limit for MAIL commands */
 extern int     smtp_max_synprot_errors;/* Max syntax/protocol errors */
 extern int     smtp_max_unknown_commands; /* As it says */
 extern uschar *smtp_names[];           /* decode for command codes */
-extern uschar *smtp_notquit_reason;    /* Global for disconnect reason */
+extern const uschar *smtp_notquit_reason; /* Global for disconnect reason */
 extern FILE   *smtp_out;               /* Incoming SMTP output file */
 extern uschar *smtp_ratelimit_hosts;   /* Rate limit these hosts */
 extern uschar *smtp_ratelimit_mail;    /* Parameters for MAIL limiting */
diff --git a/src/src/receive.c b/src/src/receive.c
index 60051e36b..02a1f96e2 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -680,7 +680,7 @@ if (!f.dot_ends)
   int last_ch = '\n';


   for ( ;
-       log_close_chk(), (ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) != EOF;
+       log_close_chk(), (ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) >= 0;
        last_ch = ch)
     {
     if (ch == 0) body_zerocount++;
@@ -723,7 +723,7 @@ if (!f.dot_ends)


ch_state = 1;

-while (log_close_chk(), (ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) != EOF)
+while (log_close_chk(), (ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) >= 0)
   {
   if (ch == 0) body_zerocount++;
   switch (ch_state)
@@ -847,7 +847,7 @@ enum { s_linestart, s_normal, s_had_cr, s_had_nl_dot, s_had_dot_cr } ch_state =
           s_linestart;
 int linelength = 0, ch;


-while ((ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) != EOF)
+while ((ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) >= 0)
   {
   if (ch == 0) body_zerocount++;
   switch (ch_state)
@@ -1829,7 +1829,7 @@ mime_part_count        = -1;
 #endif


if (misc_mod_msg_init() != OK)
- goto TIDYUP;
+ goto CONN_GONE;

 /* In SMTP sessions we may receive several messages in one connection. Before
 each subsequent one, we wait for the clock to tick at the level of message-id
@@ -1918,7 +1918,7 @@ for (;;)
       goto TIDYUP;                       /* Skip to end of function */
       }
     else if (ch == ERR)
-      goto TIDYUP;
+      goto CONN_GONE;


   /* See if we are at the current header's size limit - there must be at least
   four bytes left. This allows for the new character plus a zero, plus two for
@@ -1989,14 +1989,16 @@ for (;;)
   if (f.dot_ends && ptr == 0 && ch == '.')
     {
     /* leading dot while in headers-read mode */
-    ch = (receive_getc)(GETC_BUFFER_UNLIMITED);
+    if ((ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) < 0)
+      goto CONN_GONE;
     if (ch == '\n' && first_line_ended_crlf == TRUE /* and not TRUE_UNSET */ )
             /* dot, LF  but we are in CRLF mode.  Attack? */
       ch = ' ';    /* replace the LF with a space */


     else if (ch == '\r')
       {
-      ch = (receive_getc)(GETC_BUFFER_UNLIMITED);
+      if ((ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) < 0)
+    goto CONN_GONE;
       if (ch != '\n')
         {
     if (ch >= 0) receive_ungetc(ch);
@@ -2027,7 +2029,8 @@ for (;;)


   if (ch == '\r')
     {
-    ch = (receive_getc)(GETC_BUFFER_UNLIMITED);
+    if ((ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) < 0)
+      goto CONN_GONE;
     if (ch == '\n')
       {
       if (first_line_ended_crlf == TRUE_UNSET)
@@ -4287,12 +4290,10 @@ if (  smtp_input && sender_host_address && !f.sender_host_notsocket
   if (poll_one_fd(fileno(smtp_in), POLLIN, 0) != 0)
     {
     int c = (receive_getc)(GETC_BUFFER_UNLIMITED);
-    if (c != EOF) (receive_ungetc)(c);
+    if (c >= 0) (receive_ungetc)(c);
     else
       {
       smtp_notquit_exit(US"connection-lost", NULL, NULL);
-      smtp_reply = US"";    /* No attempt to send a response */
-      smtp_yield = FALSE;   /* Nothing more on this connection */


       /* Re-use the log line workspace */


@@ -4307,7 +4308,7 @@ if (  smtp_input && sender_host_address && !f.sender_host_notsocket
       Uunlink(spool_fname(US"input", message_subdir, message_id, US"-H"));
       Uunlink(spool_fname(US"msglog", message_subdir, message_id, US""));


-      goto TIDYUP;
+      goto CONN_GONE;
       }
     }
   }
@@ -4414,13 +4415,20 @@ Could we make this less likely by doing an fdatasync() just after the fflush()?
 That seems like a good thing on data-security grounds, but how much will it hit
 performance? */


-
goto TIDYUP;

+
+CONN_GONE:
+  smtp_reply = US"";    /* No attempt to send a response */
+  smtp_yield = FALSE;   /* Nothing more on this connection */
+  goto TIDYUP;
+
 NOT_ACCEPTED:
-message_id[0] = 0;                /* Indicate no message accepted */
+  message_id[0] = 0;            /* Indicate no message accepted */


 TIDYUP:
+DEBUG(D_receive) debug_printf("%s: tidyup\n", __FUNCTION__);
+
 process_info[process_info_len] = 0;            /* Remove message id */
 if (spool_data_file && cutthrough_done == NOT_TRIED)
   {
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index b02d1a87d..81ef57ed0 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -156,14 +156,12 @@ static struct {
 #endif
   BOOL rcpt_smtp_response_same        :1;
   BOOL rcpt_in_progress            :1;
-  BOOL smtp_exit_function_called    :1;
 #ifdef SUPPORT_I18N
   BOOL smtputf8_advertised        :1;
 #endif
 } fl = {
   .helo_verify_required = FALSE,
   .helo_verify = FALSE,
-  .smtp_exit_function_called = FALSE,
 };


 static auth_instance *authenticated_by;
@@ -325,6 +323,15 @@ static env_mail_type_t env_mail_type_list[] = {
     { US"NULL",   ENV_MAIL_OPT_NULL,   FALSE },
   };


+/* State names for debug of chunking */
+
+static const uschar * chunking_states[] = {
+  [CHUNKING_NOT_OFFERED] =    US"not-offered",
+  [CHUNKING_OFFERED] =        US"offered",
+  [CHUNKING_ACTIVE] =        US"active",
+  [CHUNKING_LAST] =        US"last" };
+
+
 /* When reading SMTP from a remote host, we have to use our own versions of the
 C input-reading functions, in order to be able to flush the SMTP output only
 when about to read more data from the socket. This is the only way to get
@@ -740,8 +747,8 @@ Returns:    the next character or ERR, EOD or EOF
 int
 bdat_getc(unsigned lim)
 {
-uschar * user_msg = NULL;
-uschar * log_msg;
+uschar * user_msg = NULL, * log_msg;
+int rc;


#ifndef DISABLE_DKIM
misc_module_info * dkim_info = misc_mod_findonly(US"dkim");
@@ -796,7 +803,8 @@ for(;;)

   smtp_printf("250 %u byte chunk received\r\n", SP_NO_MORE, chunking_datasize);
   chunking_state = CHUNKING_OFFERED;
-  DEBUG(D_receive) debug_printf("chunking state %d\n", (int)chunking_state);
+  DEBUG(D_receive)
+    debug_printf("chunking state '%s'\n", chunking_states[chunking_state]);


   /* Expect another BDAT cmd from input. RFC 3030 says nothing about
   QUIT, RSET or NOOP but handling them seems obvious */
@@ -809,14 +817,14 @@ next_cmd:
     US"only BDAT permissible after non-LAST BDAT");


   repeat_until_rset:
-      switch(smtp_read_command(TRUE, 1))
+      switch(rc = smtp_read_command(TRUE, 1))
     {
     case QUIT_CMD:    smtp_quit_handler(&user_msg, &log_msg);    /*FALLTHROUGH */
     case EOF_CMD:    return EOF;
     case RSET_CMD:    smtp_rset_handler(); return ERR;
     default:    if (synprot_error(L_smtp_protocol_error, 503, NULL,
                       US"only RSET accepted now") > 0)
-              return EOF;
+              return ERR;
             goto repeat_until_rset;
     }


@@ -848,8 +856,8 @@ next_cmd:
       chunking_state = strcmpic(smtp_cmd_data+n, US"LAST") == 0
     ? CHUNKING_LAST : CHUNKING_ACTIVE;
       chunking_data_left = chunking_datasize;
-      DEBUG(D_receive) debug_printf("chunking state %d, %d bytes\n",
-                    (int)chunking_state, chunking_data_left);
+      DEBUG(D_receive) debug_printf("chunking state '%s', %d bytes\n",
+            chunking_states[chunking_state], chunking_data_left);


       if (chunking_datasize == 0)
     if (chunking_state == CHUNKING_LAST)
@@ -904,7 +912,8 @@ while (chunking_data_left)


bdat_pop_receive_functions();
chunking_state = CHUNKING_OFFERED;
-DEBUG(D_receive) debug_printf("chunking state %d\n", (int)chunking_state);
+DEBUG(D_receive)
+ debug_printf("chunking state '%s'\n", chunking_states[chunking_state]);
}


@@ -1181,20 +1190,32 @@ Returns:       a code identifying the command (enumerated above)
 static int
 smtp_read_command(BOOL check_sync, unsigned buffer_lim)
 {
-int c;
-int ptr = 0;
+int ptr = 0, c, rc;
 BOOL hadnull = FALSE;


had_command_timeout = 0;
os_non_restarting_signal(SIGALRM, command_timeout_handler);

-while ((c = (receive_getc)(buffer_lim)) != '\n' && c != EOF)
+/* Read up to end of line */
+
+while ((c = (receive_getc)(buffer_lim)) != '\n')
   {
-  if (ptr >= SMTP_CMD_BUFFER_SIZE)
+  /* If hit end of file, return pseudo EOF command. Whether we have a
+  part-line already read doesn't matter, since this is an error state. */
+
+  if (c < 0 || ptr >= SMTP_CMD_BUFFER_SIZE)
     {
     os_non_restarting_signal(SIGALRM, sigalrm_handler);
-    return OTHER_CMD;
+    /* c could be EOF, ERR, or a good (positive) value overflowing the buffer */
+    DEBUG(D_receive)
+      if (c < 0)
+    debug_printf("SMTP(%s)<<\n", c == EOF ? "closed" : "error");
+      else
+    debug_printf("SMTP(overflow)<< '%.*s'\n",
+              SMTP_CMD_BUFFER_SIZE, smtp_cmd_buffer);
+    return c == EOF ? EOF_CMD : OTHER_CMD;
     }
+
   if (c == 0)
     {
     hadnull = TRUE;
@@ -1206,11 +1227,6 @@ while ((c = (receive_getc)(buffer_lim)) != '\n' && c != EOF)
 receive_linecount++;    /* For BSMTP errors */
 os_non_restarting_signal(SIGALRM, sigalrm_handler);


-/* If hit end of file, return pseudo EOF command. Whether we have a
-part-line already read doesn't matter, since this is an error state. */
-
-if (c == EOF) return EOF_CMD;
-
/* Remove any CR and white space at the end of the line, and terminate the
string. */

@@ -1278,9 +1294,9 @@ for (smtp_cmd_list * p = cmd_list; p < cmd_list + nelem(cmd_list); p++)
       }


     /* If there is data for a command that does not expect it, generate the
-    error here. */
+    error here. Otherwise, return the command code. */


-    return (p->has_arg || *smtp_cmd_data == 0)? p->cmd : BADARG_CMD;
+    return p->has_arg || *smtp_cmd_data == 0 ? p->cmd : BADARG_CMD;
     }
   }


@@ -1965,6 +1981,7 @@ while (done <= 0)

     case QUIT_CMD:
       f.smtp_in_quit = TRUE;
+    case OTHER_CMD:
     case EOF_CMD:
       done = 2;
       break;
@@ -2248,7 +2265,7 @@ fl.auth_advertised = FALSE;
 f.smtp_in_pipelining_advertised = f.smtp_in_pipelining_used = FALSE;
 f.pipelining_enable = TRUE;
 sync_cmd_limit = NON_SYNC_CMD_NON_PIPELINING;
-fl.smtp_exit_function_called = FALSE;    /* For avoiding loop in not-quit exit */
+smtp_notquit_reason = NULL;        /* For avoiding loop in not-quit exit */


/* If receiving by -bs from a trusted user, or testing with -bh, we allow
authentication settings from -oMaa to remain in force. */
@@ -2810,6 +2827,7 @@ log_write(type, LOG_MAIN, "SMTP %s error in \"%s\" %s %s",
type == L_smtp_syntax_error ? "syntax" : "protocol",
string_printing(smtp_cmd_buffer), host_and_ident(TRUE), errmess);

+GET_OPTION("smtp_max_synprot_errors");
if (++synprot_error_count > smtp_max_synprot_errors)
{
yield = 1;
@@ -2822,10 +2840,20 @@ if (++synprot_error_count > smtp_max_synprot_errors)

 if (code > 0)
   {
-  smtp_printf("%d%c%s%s%s\r\n", SP_NO_MORE, code, yield == 1 ? '-' : ' ',
+  BOOL more = yield == 1;
+  smtp_printf("%d%c%s%s%s\r\n", more, code, more ? '-' : ' ',
     data ? data : US"", data ? US": " : US"", errmess);
-  if (yield == 1)
-    smtp_printf("%d Too many syntax or protocol errors\r\n", SP_NO_MORE, code);
+  if (more)
+    {
+    smtp_notquit_exit(US"bad-command-synprot", string_sprintf("%d", code),
+              US"Too many syntax or protocol errors");
+    DEBUG(D_any) debug_printf_indent("SMTP(close)>>\n");
+#ifndef DISABLE_TLS
+    tls_close(NULL, TLS_SHUTDOWN_WAIT);
+#endif
+    (void) fclose(smtp_in);
+    (void) fclose(smtp_out);
+    }
   }


return yield;
@@ -3187,7 +3215,7 @@ smtp_notquit_exit(US"acl-drop", NULL, NULL);
in the TCP conn staying open, and retrying, despite this process exiting. A
malicious client could possibly do the same, tying up server netowrking
resources. Close the socket explicitly to try to avoid that (there's a note in
-the Linux socket(7) manpage, SO_LINGER para, to the effect that exim() without
+the Linux socket(7) manpage, SO_LINGER para, to the effect that exit() without
close() results in the socket always lingering). */

 (void) poll_one_fd(fileno(smtp_in), POLLIN, 200);
@@ -3227,37 +3255,41 @@ Returns:          Nothing
 */


void
-smtp_notquit_exit(uschar *reason, uschar *code, uschar *defaultrespond, ...)
+smtp_notquit_exit(const uschar * reason, uschar * code,
+ const uschar * defaultrespond, ...)
{
int rc;
uschar *user_msg = NULL;
uschar *log_msg = NULL;

-/* Check for recursive call */
+/* When a bad-command-excess is seen in the CHUNKING sub-handler, it only
+reports as EOF to the toplevel command loop - which handles EOF for the
+traditional DATA mode and calls here because the line dropped. Maybe we
+should complexify that reporting value? For now just ignore the second call
+we get when the line goes on to drop when CHUNKING. */

-if (fl.smtp_exit_function_called)
+if (smtp_notquit_reason)
   {
-  log_write(0, LOG_PANIC, "smtp_notquit_exit() called more than once (%s)",
-    reason);
+#ifdef notdef
+  log_write(0, LOG_PANIC,
+    "smtp_notquit_exit() called more than once (%s, prev: %s)",
+    reason, smtp_notquit_reason);
+#endif
   return;
   }
-fl.smtp_exit_function_called = TRUE;
+smtp_notquit_reason = reason;


/* Call the not-QUIT ACL, if there is one, unless no reason is given. */

 GET_OPTION("acl_smtp_notquit");
 if (acl_smtp_notquit && reason)
   {
-  smtp_notquit_reason = reason;
   if ((rc = acl_check(ACL_WHERE_NOTQUIT, NULL, acl_smtp_notquit, &user_msg,
               &log_msg)) == ERROR)
     log_write(0, LOG_MAIN|LOG_PANIC, "ACL for not-QUIT returned ERROR: %s",
       log_msg);
   }


-/* If the connection was dropped, we certainly are no longer talking TLS */
-tls_in.active.sock = -1;
-
/* Write an SMTP response if we are expected to give one. As the default
responses are all internal, they should be reasonable size. */

@@ -3271,7 +3303,7 @@ if (code && defaultrespond)
     va_list ap;


     va_start(ap, defaultrespond);
-    g = string_vformat(NULL, SVFMT_EXTEND|SVFMT_REBUFFER, CS defaultrespond, ap);
+    g = string_vformat(NULL, SVFMT_EXTEND|SVFMT_REBUFFER, CCS defaultrespond, ap);
     va_end(ap);
     smtp_printf("%s %Y\r\n", SP_NO_MORE, code, g);
     }
@@ -3695,7 +3727,7 @@ Argument: none


 Returns:  > 0 message successfully started (reached DATA)
           = 0 QUIT read or end of file reached or call refused
-          < 0 lost connection
+          < 0 lost connection, or synprot error
 */


 int
@@ -5179,8 +5211,8 @@ while (done <= 0)
       chunking_state = strcmpic(smtp_cmd_data+n, US"LAST") == 0
     ? CHUNKING_LAST : CHUNKING_ACTIVE;
       chunking_data_left = chunking_datasize;
-      DEBUG(D_receive) debug_printf("chunking state %d, %d bytes\n",
-                    (int)chunking_state, chunking_data_left);
+      DEBUG(D_receive) debug_printf("chunking state '%s', %d bytes\n",
+            chunking_states[chunking_state], chunking_data_left);


       f.bdat_readers_wanted = TRUE; /* FIXME: redundant vs chunking_state? */
       f.dot_ends = FALSE;
diff --git a/src/src/structs.h b/src/src/structs.h
index a32c55675..4c74608b3 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -64,7 +64,7 @@ typedef struct ugid_block {
   BOOL    initgroups;
 } ugid_block;


-typedef enum {    CHUNKING_NOT_OFFERED = -1,
+typedef enum {    CHUNKING_NOT_OFFERED = 0,
         CHUNKING_OFFERED,
         CHUNKING_ACTIVE,
         CHUNKING_LAST} chunking_state_t;
diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index 8cddcc033..7c6296786 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -550,6 +550,12 @@ record_io_error(exim_gnutls_state_st *state, int rc, uschar *when, uschar *text)
 const uschar * msg;
 uschar * errstr;


+if (rc == GNUTLS_E_INVALID_SESSION && errno == 0)
+  {
+  DEBUG(D_tls) debug_printf("- INVALID_SESSION with zero errno\n");
+  return;
+  }
+
 msg = rc == GNUTLS_E_FATAL_ALERT_RECEIVED
   ? string_sprintf("A TLS fatal alert has been received: %s",
       US gnutls_alert_get_name(gnutls_alert_get(state->session)))
diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c
index 028239095..8539d5876 100644
--- a/src/src/tls-openssl.c
+++ b/src/src/tls-openssl.c
@@ -4778,7 +4778,9 @@ for (int left = len; left > 0;)
       return -1;


     case SSL_ERROR_SYSCALL:
-      if (ct_ctx || errno != ECONNRESET || !f.smtp_in_quit)
+      if (errno == 0)
+    { DEBUG(D_tls) debug_printf("- SSL_ERROR_SYSCALL with zero errno\n"); }
+      else if (ct_ctx || errno != ECONNRESET || !f.smtp_in_quit)
     log_write(0, LOG_MAIN, "SSL_write: (from %s) syscall: %s",
       sender_fullhost ? sender_fullhost : US"<unknown>",
       strerror(errno));
diff --git a/test/log/0901 b/test/log/0901
index 7d4a715b5..364b3b942 100644
--- a/test/log/0901
+++ b/test/log/0901
@@ -12,4 +12,3 @@
 1999-03-02 09:44:33 10HmbF-000000005vi-0000 <= someone8@??? H=(tester) [127.0.0.1] P=esmtp K S=sss for CALLER@???
 1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "BDAT 1" H=(tester) [127.0.0.1] next input="BDAT 87 last\r\no: Susan@???"...
 1999-03-02 09:44:33 SMTP call from (tester) [127.0.0.1] dropped: too many syntax or protocol errors (last command was "From: Sam@???",  C=EHLO,MAIL,RCPT,BDAT)
-1999-03-02 09:44:33 SMTP connection from (tester) [127.0.0.1] lost while reading message data (header)
diff --git a/test/stderr/0022 b/test/stderr/0022
index 7be2959df..495b2c111 100644
--- a/test/stderr/0022
+++ b/test/stderr/0022
@@ -71,6 +71,7 @@ P Received: from [V4NET.9.8.7] (helo=test)
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= x@y H=(test) [V4NET.9.8.7] P=smtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmbF-000000005vi-0000

 smtp_setup_msg entered
 SMTP<< quit
@@ -155,6 +156,7 @@ P Received: from [V4NET.9.8.7] (helo=test)
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= x@y H=(test) [V4NET.9.8.7] P=smtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmbG-000000005vi-0000

smtp_setup_msg entered
SMTP<< quit
@@ -240,6 +242,7 @@ P Received: from [V4NET.9.8.7] (helo=test)
>>

LOG: MAIN
<= x@y H=(test) [V4NET.9.8.7] P=smtp S=sss
+receive_msg: tidyup
SMTP>> 250 OK id=10HmbH-000000005vi-0000

 smtp_setup_msg entered
 SMTP<< quit
diff --git a/test/stderr/0044 b/test/stderr/0044
index e044102cd..e4113bfd0 100644
--- a/test/stderr/0044
+++ b/test/stderr/0044
@@ -167,6 +167,7 @@ P Received: from [V4NET.11.12.13] (helo=exim.test.ex)
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= postmaster@??? H=(exim.test.ex) [V4NET.11.12.13] P=esmtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmaX-000000005vi-0000

smtp_setup_msg entered
SMTP<< quit
@@ -336,6 +337,7 @@ SMTP>> 550-Unrouteable address
SMTP>> 550 Sender verify failed

LOG: MAIN REJECT
H=(exim.test.ex) [V4NET.99.99.99] F=<postmaster@???> rejected RCPT list@???: Sender verify failed
+SMTP(closed)<<
SMTP>> 421 the.local.host.name lost input connection

LOG: lost_incoming_connection MAIN
unexpected disconnection while reading SMTP command from (exim.test.ex) [V4NET.99.99.99] D=qqs
diff --git a/test/stderr/0275 b/test/stderr/0275
index d8ee843ae..1a98284a9 100644
--- a/test/stderr/0275
+++ b/test/stderr/0275
@@ -233,6 +233,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0278 b/test/stderr/0278
index 08709b257..1d5929dff 100644
--- a/test/stderr/0278
+++ b/test/stderr/0278
@@ -138,6 +138,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0294 b/test/stderr/0294
index 47af581ab..4891c2167 100644
--- a/test/stderr/0294
+++ b/test/stderr/0294
@@ -57,6 +57,7 @@ Size of headers = sss
LOG: MAIN
<= x@y U=CALLER P=local-smtp S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaX-000000005vi-0000

smtp_setup_msg entered
SMTP<< mail from:<x@y>
@@ -90,6 +91,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= x@y U=CALLER P=local-smtp S=sss
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaY-000000005vi-0000

 smtp_setup_msg entered
 SMTP<< mail from:<x@y>
diff --git a/test/stderr/0303 b/test/stderr/0303
index ea3f63024..427a66a2e 100644
--- a/test/stderr/0303
+++ b/test/stderr/0303
@@ -137,6 +137,7 @@ P Received: from [V4NET.2.3.4]
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= <> H=([V4NET.2.3.4]) [V4NET.2.3.4] P=esmtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmaX-000000005vi-0000

 smtp_setup_msg entered
 SMTP<< quit
@@ -221,6 +222,7 @@ P Received: from host.name.tld ([V4NET.2.3.4])
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= <> H=host.name.tld [V4NET.2.3.4] P=esmtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmaY-000000005vi-0000

smtp_setup_msg entered
SMTP<< quit
diff --git a/test/stderr/0317 b/test/stderr/0317
index 395120669..ac90467d0 100644
--- a/test/stderr/0317
+++ b/test/stderr/0317
@@ -33,6 +33,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1234 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -74,4 +75,5 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1235 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

diff --git a/test/stderr/0361 b/test/stderr/0361
index 171d925e6..afd7dbcf4 100644
--- a/test/stderr/0361
+++ b/test/stderr/0361
@@ -51,6 +51,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -N -odi -Mc 10HmaY-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0371 b/test/stderr/0371
index f607c1668..035c73cf3 100644
--- a/test/stderr/0371
+++ b/test/stderr/0371
@@ -110,6 +110,7 @@ accept: condition test succeeded in ACL data
end of ACL data: ACCEPT
LOG: MAIN
<= x@y H=(something) [V4NET.0.0.0] P=esmtp S=sss
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaX-000000005vi-0000

smtp_setup_msg entered
SMTP<< vrfy x@y
diff --git a/test/stderr/0386 b/test/stderr/0386
index 592ca2c53..fedf1e3d3 100644
--- a/test/stderr/0386
+++ b/test/stderr/0386
@@ -280,6 +280,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaX-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= x@y H=(test) [V4NET.11.12.13] U=CALLER P=smtp S=sss
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaX-000000005vi-0000

search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
@@ -470,6 +471,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= x@y H=(test) [V4NET.11.12.13] U=CALLER P=smtp S=sss
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaY-000000005vi-0000

search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaY-000000005vi-0000
diff --git a/test/stderr/0402 b/test/stderr/0402
index d0906810d..2009b5509 100644
--- a/test/stderr/0402
+++ b/test/stderr/0402
@@ -409,6 +409,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715dfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0403 b/test/stderr/0403
index 449b63a6d..cdca19eb7 100644
--- a/test/stderr/0403
+++ b/test/stderr/0403
@@ -45,6 +45,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -N -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
@@ -275,6 +276,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -N -odi -Mc 10HmaY-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0408 b/test/stderr/0408
index 38c348765..e4575e489 100644
--- a/test/stderr/0408
+++ b/test/stderr/0408
@@ -45,6 +45,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/0465 b/test/stderr/0465
index 9518d278e..80baa9fbf 100644
--- a/test/stderr/0465
+++ b/test/stderr/0465
@@ -101,6 +101,7 @@ Size of headers = sss
LOG: MAIN
<= <> U=CALLER P=local-smtp S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaY-000000005vi-0000

smtp_setup_msg entered
SMTP<< quit
@@ -174,6 +175,7 @@ end of ACL check_data: implicit DENY
SMTP>> 550 Administrative prohibition

LOG: MAIN REJECT
U=CALLER F=<> rejected after DATA: domain missing or malformed: failing address in "To:" header is: abc@xyz.
+receive_msg: tidyup
smtp_setup_msg entered
SMTP<< quit
SMTP>> 221 myhost.test.ex closing connection

diff --git a/test/stderr/0471 b/test/stderr/0471
index 8ebed01de..90bc9dacf 100644
--- a/test/stderr/0471
+++ b/test/stderr/0471
@@ -26883,6 +26883,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1234 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
@@ -27080,6 +27081,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1235 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
@@ -27277,6 +27279,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaZ-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1236 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
@@ -27446,6 +27449,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbA-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1237 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
@@ -27610,6 +27614,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbB-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1238 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
@@ -27779,5 +27784,6 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbC-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=p1239 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

diff --git a/test/stderr/0487 b/test/stderr/0487
index 3cb2b26b2..7fa228442 100644
--- a/test/stderr/0487
+++ b/test/stderr/0487
@@ -76,6 +76,7 @@ Size of headers = sss
LOG: MAIN
<= x@y U=CALLER P=local-esmtp S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
SMTP>> 250 OK id=10HmaX-000000005vi-0000

search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
diff --git a/test/stderr/0489 b/test/stderr/0489
index 80e21ae5d..40f6bb8dd 100644
--- a/test/stderr/0489
+++ b/test/stderr/0489
@@ -31,6 +31,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1234 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -64,6 +65,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1235 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -97,6 +99,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaZ-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1236 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -130,6 +133,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbA-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1237 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -163,6 +167,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbB-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1238 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -196,6 +201,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbC-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1239 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -229,6 +235,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbD-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1240 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

Exim version x.yz ....
Hints DB:
@@ -262,4 +269,5 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbE-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
>>>>>>>>>>>>>>>> Exim pid=p1241 (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>>

diff --git a/test/stderr/0575 b/test/stderr/0575
index ef23ff943..939242d96 100644
--- a/test/stderr/0575
+++ b/test/stderr/0575
@@ -63,6 +63,7 @@ P Received: from [V4NET.0.0.0] (helo=test)
     Tue, 2 Mar 1999 09:44:33 +0000
 LOG: MAIN
   <= x@y H=(test) [V4NET.0.0.0] P=smtp S=sss
+receive_msg: tidyup

SMTP>> 250 OK id=10HmaX-000000005vi-0000

 smtp_setup_msg entered
 SMTP<< quit
diff --git a/test/stderr/0628 b/test/stderr/0628
index 7b1459f1b..882f15669 100644
--- a/test/stderr/0628
+++ b/test/stderr/0628
@@ -11,6 +11,7 @@
 01:01:01 p1237  Size of headers = sss
 01:01:01 p1237  LOG: MAIN
 01:01:01 p1237    <= tester@??? H=(test.ex) [127.0.0.1] P=esmtp S=sss
+01:01:01 p1237  receive_msg: tidyup
 01:01:01 p1237  SMTP>> 250 OK id=10HmaX-000000005vi-0000
 01:01:01 p1237  search_tidyup called
 01:01:01 p1237  Sender: tester@???
@@ -127,6 +128,7 @@
 01:01:01 p1240    <= tester2@??? H=(test.ex) [127.0.0.1] P=esmtp S=sss
 01:01:01 p1240  LOG: delay_delivery MAIN
 01:01:01 p1240    no immediate delivery: queued by ACL
+01:01:01 p1240  receive_msg: tidyup
 01:01:01 p1240  SMTP>> 250 OK id=10HmaY-000000005vi-0000
 01:01:01 p1240  search_tidyup called
 01:01:01 p1240  Sender: tester2@???
diff --git a/test/stderr/2202 b/test/stderr/2202
index d6e38f3a8..ea2b79c08 100644
--- a/test/stderr/2202
+++ b/test/stderr/2202
@@ -184,6 +184,7 @@ end of ACL vrfy: implicit DENY

SMTP>> 252 Administrative prohibition

LOG: MAIN REJECT
H=[ip4.ip4.ip4.ip4] rejected VRFY a@???
+SMTP(closed)<<
SMTP>> 421 myhost.test.ex lost input connection

LOG: smtp_connection MAIN
SMTP connection from [ip4.ip4.ip4.ip4] lost D=qqs
diff --git a/test/stderr/2600 b/test/stderr/2600
index 592eb9711..ad9b921fe 100644
--- a/test/stderr/2600
+++ b/test/stderr/2600
@@ -559,6 +559,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -DOPT=y -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/2610 b/test/stderr/2610
index af6db6216..9517d8fc8 100644
--- a/test/stderr/2610
+++ b/test/stderr/2610
@@ -811,6 +811,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/2620 b/test/stderr/2620
index 05f2f445e..3c4305f77 100644
--- a/test/stderr/2620
+++ b/test/stderr/2620
@@ -750,6 +750,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/4155 b/test/stderr/4155
index e8cc4ac77..6070650e6 100644
--- a/test/stderr/4155
+++ b/test/stderr/4155
@@ -144,6 +144,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
@@ -903,6 +904,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= <> R=10HmaX-000000005vi-0000 U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaY-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/5004 b/test/stderr/5004
index 3eba9a65b..41ac2b29e 100644
--- a/test/stderr/5004
+++ b/test/stderr/5004
@@ -47,6 +47,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/5005 b/test/stderr/5005
index 9f3d8c172..06da037dc 100644
--- a/test/stderr/5005
+++ b/test/stderr/5005
@@ -45,6 +45,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....
@@ -229,6 +230,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaY-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaY-000000005vi-0000
Exim version x.yz ....
@@ -415,6 +417,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmaZ-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaZ-000000005vi-0000
Exim version x.yz ....
@@ -605,6 +608,7 @@ Renaming spool header file: TESTSUITE/spool//input//10HmbA-000000005vi-0000-H
Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmbA-000000005vi-0000
Exim version x.yz ....
diff --git a/test/stderr/5006 b/test/stderr/5006
index d9e4556ef..a010cb023 100644
--- a/test/stderr/5006
+++ b/test/stderr/5006
@@ -45,6 +45,7 @@ Size of headers = sss
LOG: MAIN
<= CALLER@??? U=CALLER P=local S=sss
created log directory TESTSUITE/spool/log
+receive_msg: tidyup
search_tidyup called
exec TESTSUITE/eximdir/exim -DEXIM_PATH=TESTSUITE/eximdir/exim -C TESTSUITE/test-config -d=0xf7715cfd -MCd local-accept-delivery -odi -Mc 10HmaX-000000005vi-0000
Exim version x.yz ....

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/