summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2007-01-30 15:10:58 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2007-01-30 15:10:58 +0000
commit41c7c167f4d3552804bfaf7278d72fc448b851ff (patch)
treef462813d5fc6fa01ff8523deccf655fa5b806516
parentcf8b11a5399e64e50b6cd58f56a98197aca599d8 (diff)
Magnus' patch for $sending_ip_address and $sending_port.
-rw-r--r--doc/doc-txt/ChangeLog7
-rw-r--r--doc/doc-txt/NewStuff21
-rw-r--r--src/ACKNOWLEDGMENTS6
-rw-r--r--src/src/exim.c18
-rw-r--r--src/src/expand.c4
-rw-r--r--src/src/globals.c4
-rw-r--r--src/src/globals.h4
-rw-r--r--src/src/smtp_out.c13
-rw-r--r--src/src/transports/smtp.c52
-rw-r--r--src/src/verify.c34
-rw-r--r--test/confs/055044
-rw-r--r--test/log/05503
-rw-r--r--test/scripts/0000-Basic/055025
-rw-r--r--test/scripts/2000-GnuTLS/20132
-rw-r--r--test/scripts/2100-OpenSSL/21132
-rw-r--r--test/stderr/201366
-rw-r--r--test/stderr/211366
-rw-r--r--test/stdout/055024
18 files changed, 354 insertions, 41 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index ab30b633e..f487761c7 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.464 2007/01/30 11:45:20 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.465 2007/01/30 15:10:58 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -62,6 +62,11 @@ PH/10 The acl_not_smtp_start ACL was, contrary to the documentation, not being
PH/11 Added control=no_pipelining.
+PH/12 Added $sending_ip_address and $sending_port (mostly Magnus Holmgren's
+ patch, slightly modified), and move the expansion of helo_data till after
+ the connection is made in the smtp transport (so it can use these
+ values).
+
Exim version 4.66
-----------------
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index f5b8bd949..bdfe78c22 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.131 2007/01/30 11:45:20 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.132 2007/01/30 15:10:58 ph10 Exp $
New Features in Exim
--------------------
@@ -203,6 +203,25 @@ Version 4.67
an EHLO command. Therefore, it should normally appear in an ACL controlled
by acl_smtp_connect or acl_smtp_helo.
+ 7. There are two new variables called $sending_ip_address and $sending_port.
+ These are set whenever an SMTP connection to another host has been set up,
+ and they contain the IP address and port of the local interface that is
+ being used. They are of interest only on hosts that have more than on IP
+ address that want to take on different personalities depending on which one
+ is being used.
+
+ 8. The expansion of the helo_data option in the smtp transport now happens
+ after the connection to the server has been made. This means that it can
+ use the value of $sending_ip_address (see 7 above) to vary the text of the
+ message. For example, if you want the string that is used for helo_data to
+ be obtained by a DNS lookup of the interface address, you could use this:
+
+ helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
+ {$primary_hostname}}
+
+ The use of helo_data applies both to sending messages and when doing
+ callouts.
+
Version 4.66
------------
diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS
index a4b601652..23a6de7ff 100644
--- a/src/ACKNOWLEDGMENTS
+++ b/src/ACKNOWLEDGMENTS
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.68 2007/01/17 11:17:58 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.69 2007/01/30 15:10:59 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -20,7 +20,7 @@ relatively small patches.
Philip Hazel
Lists created: 20 November 2002
-Last updated: 17 January 2007
+Last updated: 30 January 2007
THE OLD LIST
@@ -166,6 +166,8 @@ Jakob Hirsch Patch for % operator
Patch for arbitrarily named ACL variables
Magnus Holmgren Patch for filter_prepend_home
Patch for "h" flag in Domain Keys
+ Patch for $sending_ip_address/$sending_port
+ Lots of other support
Kjetil Torgrim Homme Patch for require_files problem on NFS file systems
Tom Hughes Suggested patch for $n bug in pipe command from filter
Pierre Humblet Continued Cygwin support
diff --git a/src/src/exim.c b/src/src/exim.c
index 6f80dd131..49830c0de 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/exim.c,v 1.54 2007/01/25 15:51:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/exim.c,v 1.55 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2165,6 +2165,9 @@ for (i = 1; i < argc; i++)
if (Ustrcmp(argrest, "C") == 0)
{
+ union sockaddr_46 interface_sock;
+ EXIM_SOCKLEN_T size = sizeof(interface_sock);
+
if (argc != i + 6)
{
fprintf(stderr, "exim: too many or too few arguments after -MC\n");
@@ -2194,6 +2197,19 @@ for (i = 1; i < argc; i++)
return EXIT_FAILURE;
}
+ /* Set up $sending_ip_address and $sending_port */
+
+ if (getsockname(fileno(stdin), (struct sockaddr *)(&interface_sock),
+ &size) == 0)
+ sending_ip_address = host_ntoa(-1, &interface_sock, NULL,
+ &sending_port);
+ else
+ {
+ fprintf(stderr, "exim: getsockname() failed after -MC option: %s\n",
+ strerror(errno));
+ return EXIT_FAILURE;
+ }
+
if (running_in_test_harness) millisleep(500);
break;
}
diff --git a/src/src/expand.c b/src/src/expand.c
index 03cc85a80..a9b474939 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.77 2007/01/23 14:34:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.78 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -525,6 +525,8 @@ static var_entry var_table[] = {
{ "sender_rate_period", vtype_stringptr, &sender_rate_period },
{ "sender_rcvhost", vtype_stringptr, &sender_rcvhost },
{ "sender_verify_failure",vtype_stringptr, &sender_verify_failure },
+ { "sending_ip_address", vtype_stringptr, &sending_ip_address },
+ { "sending_port", vtype_int, &sending_port },
{ "smtp_active_hostname", vtype_stringptr, &smtp_active_hostname },
{ "smtp_command", vtype_stringptr, &smtp_cmd_buffer },
{ "smtp_command_argument", vtype_stringptr, &smtp_cmd_argument },
diff --git a/src/src/globals.c b/src/src/globals.c
index 969ac7189..880b99985 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.65 2007/01/30 11:45:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.66 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1031,6 +1031,8 @@ address_item *sender_verified_list = NULL;
address_item *sender_verified_failed = NULL;
int sender_verified_rc = -1;
BOOL sender_verified_responded = FALSE;
+uschar *sending_ip_address = NULL;
+int sending_port = -1;
volatile BOOL sigalrm_seen = FALSE;
uschar **sighup_argv = NULL;
int smtp_accept_count = 0;
diff --git a/src/src/globals.h b/src/src/globals.h
index 75f665041..70227d592 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.46 2007/01/30 11:45:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -619,6 +619,8 @@ extern uschar *sender_unqualified_hosts; /* Permitted unqualified senders */
extern uschar *sender_verify_failure; /* What went wrong */
extern address_item *sender_verified_list; /* Saved chain of sender verifies */
extern address_item *sender_verified_failed; /* The one that caused denial */
+extern uschar *sending_ip_address; /* Address of outgoing (SMTP) interface */
+extern int sending_port; /* Port of outgoing interface */
extern volatile BOOL sigalrm_seen; /* Flag for sigalrm_handler */
extern uschar **sighup_argv; /* Args for re-execing after SIGHUP */
extern int smtp_accept_count; /* Count of connections */
diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c
index 4186b787a..d4aed3735 100644
--- a/src/src/smtp_out.c
+++ b/src/src/smtp_out.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/smtp_out.c,v 1.8 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_out.c,v 1.9 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -241,7 +241,18 @@ if (save_errno != 0)
else
{
+ union sockaddr_46 interface_sock;
+ EXIM_SOCKLEN_T size = sizeof(interface_sock);
HDEBUG(D_transport|D_acl|D_v) debug_printf("connected\n");
+ if (getsockname(sock, (struct sockaddr *)(&interface_sock), &size) == 0)
+ sending_ip_address = host_ntoa(-1, &interface_sock, NULL, &sending_port);
+ else
+ {
+ log_write(0, LOG_MAIN | ((errno == ECONNRESET)? 0 : LOG_PANIC),
+ "getsockname() failed: %s", strerror(errno));
+ close(sock);
+ return -1;
+ }
if (keepalive) ip_keepalive(sock, host->address, TRUE);
return sock;
}
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index c1396b9b4..cf09010cb 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.32 2007/01/22 16:29:55 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.33 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -848,7 +848,7 @@ smtp_outblock outblock;
int max_rcpt = tblock->max_addresses;
uschar *igquotstr = US"";
uschar *local_authenticated_sender = authenticated_sender;
-uschar *helo_data;
+uschar *helo_data = NULL;
uschar *message = NULL;
uschar new_message_id[MESSAGE_ID_LENGTH + 1];
uschar *p;
@@ -877,17 +877,6 @@ outblock.ptr = outbuffer;
outblock.cmd_count = 0;
outblock.authenticating = FALSE;
-/* Expand the greeting message */
-
-helo_data = expand_string(ob->helo_data);
-if (helo_data == NULL)
- {
- uschar *message = string_sprintf("failed to expand helo_data: %s",
- expand_string_message);
- set_errno(addrlist, 0, message, DEFER, FALSE);
- return ERROR;
- }
-
/* If an authenticated_sender override has been specified for this transport
instance, expand it. If the expansion is forced to fail, and there was already
an authenticated_sender for this message, the original value will be used.
@@ -927,6 +916,12 @@ if (continue_hostname == NULL)
return DEFER;
}
+ /* Expand the greeting message while waiting for the initial response. (Makes
+ sense if helo_data contains ${lookup dnsdb ...} stuff). The expansion is
+ delayed till here so that $sending_interface and $sending_port are set. */
+
+ helo_data = expand_string(ob->helo_data);
+
/* The first thing is to wait for an initial OK response. The dreaded "goto"
is nevertheless a reasonably clean way of programming this kind of logic,
where you want to escape on any error. */
@@ -934,6 +929,18 @@ if (continue_hostname == NULL)
if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2',
ob->command_timeout)) goto RESPONSE_FAILED;
+ /* Now check if the helo_data expansion went well, and sign off cleanly if it
+ didn't. */
+
+ if (helo_data == NULL)
+ {
+ uschar *message = string_sprintf("failed to expand helo_data: %s",
+ expand_string_message);
+ set_errno(addrlist, 0, message, DEFER, FALSE);
+ yield = DEFER;
+ goto SEND_QUIT;
+ }
+
/** Debugging without sending a message
addrlist->transport_return = DEFER;
goto SEND_QUIT;
@@ -1103,10 +1110,27 @@ if (tls_offered && !suppress_tls &&
}
}
-/* If we started TLS, redo the EHLO/LHLO exchange over the secure channel. */
+/* If we started TLS, redo the EHLO/LHLO exchange over the secure channel. If
+helo_data is null, we are dealing with a connection that was passed from
+another process, and so we won't have expanded helo_data above. We have to
+expand it here. $sending_ip_address and $sending_port are set up right at the
+start of the Exim process (in exim.c). */
if (tls_active >= 0)
{
+ if (helo_data == NULL)
+ {
+ helo_data = expand_string(ob->helo_data);
+ if (helo_data == NULL)
+ {
+ uschar *message = string_sprintf("failed to expand helo_data: %s",
+ expand_string_message);
+ set_errno(addrlist, 0, message, DEFER, FALSE);
+ yield = DEFER;
+ goto SEND_QUIT;
+ }
+ }
+
if (smtp_write_command(&outblock, FALSE, "%s %s\r\n", lmtp? "LHLO" : "EHLO",
helo_data) < 0)
goto SEND_FAILED;
diff --git a/src/src/verify.c b/src/src/verify.c
index 3b0983919..5ec90aaa8 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/verify.c,v 1.46 2007/01/17 11:17:58 ph10 Exp $ */
+/* $Cambridge: exim/src/src/verify.c,v 1.47 2007/01/30 15:10:59 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -442,21 +442,6 @@ for (host = host_list; host != NULL && !done; host = host->next)
log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: %s", addr->address,
addr->message);
- /* Expand the helo_data string to find the host name to use. */
-
- if (tf->helo_data != NULL)
- {
- uschar *s = expand_string(tf->helo_data);
- if (s == NULL)
- log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: failed to expand transport's "
- "helo_data value for callout: %s", addr->address,
- expand_string_message);
- else active_hostname = s;
- }
-
- deliver_host = deliver_host_address = NULL;
- deliver_domain = save_deliver_domain;
-
/* Set HELO string according to the protocol */
if (Ustrcmp(tf->protocol, "lmtp") == 0) helo = US"LHLO";
@@ -487,9 +472,26 @@ for (host = host_list; host != NULL && !done; host = host->next)
{
addr->message = string_sprintf("could not connect to %s [%s]: %s",
host->name, host->address, strerror(errno));
+ deliver_host = deliver_host_address = NULL;
+ deliver_domain = save_deliver_domain;
continue;
}
+ /* Expand the helo_data string to find the host name to use. */
+
+ if (tf->helo_data != NULL)
+ {
+ uschar *s = expand_string(tf->helo_data);
+ if (s == NULL)
+ log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: failed to expand transport's "
+ "helo_data value for callout: %s", addr->address,
+ expand_string_message);
+ else active_hostname = s;
+ }
+
+ deliver_host = deliver_host_address = NULL;
+ deliver_domain = save_deliver_domain;
+
/* Wait for initial response, and send HELO. The smtp_write_command()
function leaves its command in big_buffer. This is used in error responses.
Initialize it in case the connection is rejected. */
diff --git a/test/confs/0550 b/test/confs/0550
new file mode 100644
index 000000000..e08750fdd
--- /dev/null
+++ b/test/confs/0550
@@ -0,0 +1,44 @@
+# Exim test configuration 0550
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+rfc1413_query_timeout = 0s
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+ driver = accept
+ transport = t1
+
+
+# ----- Transports -----
+
+begin transports
+
+t1:
+ driver = smtp
+ hosts = 127.0.0.1 : HOSTIPV4
+ port = PORT_S
+ allow_localhost
+ helo_data = \
+ ${if eq{$sending_ip_address}{127.0.0.1}{Tweedledum}{Tweedledee}} \
+ to $host [$host_address]
+
+
+# ------ Retry ------
+
+begin retry
+
+* * F,1d,1d
+
+# End
diff --git a/test/log/0550 b/test/log/0550
new file mode 100644
index 000000000..30da3add6
--- /dev/null
+++ b/test/log/0550
@@ -0,0 +1,3 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 SMTP error from remote mail server after MAIL FROM:<CALLER@myhost.test.ex>: host 127.0.0.1 [127.0.0.1]: 450 Defer
+1999-03-02 09:44:33 10HmaX-0005vi-00 == userx@test.ex R=r1 T=t1 defer (-45): SMTP error from remote mail server after MAIL FROM:<CALLER@myhost.test.ex>: host ipv4.ipv4.ipv4.ipv4 [ipv4.ipv4.ipv4.ipv4]: 450 Defer
diff --git a/test/scripts/0000-Basic/0550 b/test/scripts/0000-Basic/0550
new file mode 100644
index 000000000..9ca969971
--- /dev/null
+++ b/test/scripts/0000-Basic/0550
@@ -0,0 +1,25 @@
+# $sending_ip_address
+need_ipv4
+#
+server PORT_S 2
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL FROM
+450 Defer
+QUIT
+221 OK
+*EOF
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL FROM
+450 Defer
+QUIT
+221 OK
+****
+exim -odi userx@test.ex
+****
+no_msglog_check
diff --git a/test/scripts/2000-GnuTLS/2013 b/test/scripts/2000-GnuTLS/2013
index ef34a6677..f3d5719f0 100644
--- a/test/scripts/2000-GnuTLS/2013
+++ b/test/scripts/2000-GnuTLS/2013
@@ -8,7 +8,7 @@ Test message 1
exim userx@test.ex
Test message 2
****
-exim -qqf
+exim -qqf -d-all+acl
****
killdaemon
exim -DSERVER=server -DNOTDAEMON -qf
diff --git a/test/scripts/2100-OpenSSL/2113 b/test/scripts/2100-OpenSSL/2113
index 292b4086a..be1f5e4b4 100644
--- a/test/scripts/2100-OpenSSL/2113
+++ b/test/scripts/2100-OpenSSL/2113
@@ -7,7 +7,7 @@ Test message 1
exim userx@test.ex
Test message 2
****
-exim -qqf
+exim -qqf -d-all+acl
****
killdaemon
exim -DSERVER=server -DNOTDAEMON -qf
diff --git a/test/stderr/2013 b/test/stderr/2013
new file mode 100644
index 000000000..7a2cc7eca
--- /dev/null
+++ b/test/stderr/2013
@@ -0,0 +1,66 @@
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: queue_run MAIN
+ Start queue run: pid=pppp -qqf
+Connecting to 127.0.0.1 [127.0.0.1]:1225 ... connected
+ SMTP<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmaZ-0005vi-00
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] X=TLS-1.0:RSA_AES_256_CBC_SHA1:32 DN="C=UK,L=Cambridge,O=University of Cambridge,OU=Computing Service,CN=Philip Hazel"
+LOG: MAIN
+ Completed
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmbA-0005vi-00
+ SMTP>> QUIT
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1]* X=TLS-1.0:RSA_AES_256_CBC_SHA1:32 DN="C=UK,L=Cambridge,O=University of Cambridge,OU=Computing Service,CN=Philip Hazel"
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+LOG: queue_run MAIN
+ End queue run: pid=pppp -qqf
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+
+******** SERVER ********
diff --git a/test/stderr/2113 b/test/stderr/2113
new file mode 100644
index 000000000..d2fab9bca
--- /dev/null
+++ b/test/stderr/2113
@@ -0,0 +1,66 @@
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: queue_run MAIN
+ Start queue run: pid=pppp -qqf
+Connecting to 127.0.0.1 [127.0.0.1]:1225 ... connected
+ SMTP<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmaZ-0005vi-00
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250-STARTTLS
+ 250 HELP
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] X=TLSv1:AES256-SHA:256 DN="/C=UK/L=Cambridge/O=University of Cambridge/OU=Computing Service/CN=Philip Hazel"
+LOG: MAIN
+ Completed
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+ SMTP>> STARTTLS
+ SMTP<< 220 TLS go ahead
+ SMTP>> EHLO myhost.test.ex
+ SMTP<< 250-myhost.test.ex Hello localhost [127.0.0.1]
+ 250-SIZE 52428800
+ 250-PIPELINING
+ 250 HELP
+ SMTP>> MAIL FROM:<CALLER@myhost.test.ex> SIZE=ssss
+ SMTP>> RCPT TO:<userx@test.ex>
+ SMTP>> DATA
+ SMTP<< 250 OK
+ SMTP<< 250 Accepted
+ SMTP<< 354 Enter message, ending with "." on a line by itself
+ SMTP<< 250 OK id=10HmbA-0005vi-00
+ SMTP>> QUIT
+LOG: MAIN
+ => userx@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1]* X=TLSv1:AES256-SHA:256 DN="/C=UK/L=Cambridge/O=University of Cambridge/OU=Computing Service/CN=Philip Hazel"
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+LOG: queue_run MAIN
+ End queue run: pid=pppp -qqf
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+
+******** SERVER ********
diff --git a/test/stdout/0550 b/test/stdout/0550
new file mode 100644
index 000000000..57ef22d25
--- /dev/null
+++ b/test/stdout/0550
@@ -0,0 +1,24 @@
+
+******** SERVER ********
+Listening on port 1224 ...
+Connection request from [127.0.0.1]
+220 ESMTP
+EHLO Tweedledum to 127.0.0.1 [127.0.0.1]
+250-OK
+250 HELP
+MAIL FROM:<CALLER@myhost.test.ex>
+450 Defer
+QUIT
+221 OK
+Unexpected EOF read from client
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO Tweedledee to ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]
+250-OK
+250 HELP
+MAIL FROM:<CALLER@myhost.test.ex>
+450 Defer
+QUIT
+221 OK
+End of script