summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/doc-docbook/spec.xfpt3
-rw-r--r--doc/doc-txt/ChangeLog2
-rw-r--r--src/src/deliver.c35
-rw-r--r--src/src/transports/lmtp.c8
-rw-r--r--test/log/510014
-rw-r--r--test/log/51018
-rw-r--r--test/log/51026
7 files changed, 44 insertions, 32 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index ece837d03..40384c3eb 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -34333,7 +34333,8 @@ The message that is written is &"spool file is locked"&.
.next
.cindex "log" "smtp confirmation"
.cindex "SMTP" "logging confirmation"
-&%smtp_confirmation%&: The response to the final &"."& in the SMTP dialogue for
+.cindex "LMTP" "logging confirmation"
+&%smtp_confirmation%&: The response to the final &"."& in the SMTP or LMTP dialogue for
outgoing messages is added to delivery log lines in the form &`C=`&<&'text'&>.
A number of MTAs (including Exim) return an identifying string in this
response.
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 082caa882..331842f83 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -35,6 +35,8 @@ TL/03 Bugzilla 1433: Fix DMARC SEGV with specific From header contents.
PP/01 Continue incomplete 4.82 PP/19 by fixing docs too: use dns_dnssec_ok
not dns_use_dnssec.
+JH/03 Bugzilla 1157: support log_selector smtp_confirmation for lmtp.
+
Exim version 4.82
-----------------
diff --git a/src/src/deliver.c b/src/src/deliver.c
index b1a3b4cc6..df93a114e 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -812,23 +812,26 @@ else
if (addr->flags & af_prdr_used)
s = string_append(s, &size, &ptr, 1, US" PRDR");
#endif
+ }
- if ((log_extra_selector & LX_smtp_confirmation) != 0 &&
- addr->message != NULL)
- {
- int i;
- uschar *p = big_buffer;
- uschar *ss = addr->message;
- *p++ = '\"';
- for (i = 0; i < 100 && ss[i] != 0; i++)
- {
- if (ss[i] == '\"' || ss[i] == '\\') *p++ = '\\';
- *p++ = ss[i];
- }
- *p++ = '\"';
- *p = 0;
- s = string_append(s, &size, &ptr, 2, US" C=", big_buffer);
- }
+/* confirmation message (SMTP (host_used) and LMTP (driver_name)) */
+
+if ((log_extra_selector & LX_smtp_confirmation) != 0 &&
+ addr->message != NULL &&
+ ((addr->host_used != NULL) || (Ustrcmp(addr->transport->driver_name, "lmtp") == 0)))
+ {
+ int i;
+ uschar *p = big_buffer;
+ uschar *ss = addr->message;
+ *p++ = '\"';
+ for (i = 0; i < 100 && ss[i] != 0; i++)
+ {
+ if (ss[i] == '\"' || ss[i] == '\\') *p++ = '\\';
+ *p++ = ss[i];
+ }
+ *p++ = '\"';
+ *p = 0;
+ s = string_append(s, &size, &ptr, 2, US" C=", big_buffer);
}
/* Time on queue and actual time taken to deliver */
diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c
index 06eb72969..7a1e7c471 100644
--- a/src/src/transports/lmtp.c
+++ b/src/src/transports/lmtp.c
@@ -662,8 +662,14 @@ if (send_data)
if (addr->transport_return != PENDING_OK) continue;
if (lmtp_read_response(out, buffer, sizeof(buffer), '2', timeout))
+ {
addr->transport_return = OK;
-
+ if ((log_extra_selector & LX_smtp_confirmation) != 0)
+ {
+ uschar *s = string_printing(buffer);
+ addr->message = (s == buffer)? (uschar *)string_copy(s) : s;
+ }
+ }
/* If the response has failed badly, use it for all the remaining pending
addresses and give up. */
diff --git a/test/log/5100 b/test/log/5100
index ec4a807ff..5c4f5ce46 100644
--- a/test/log/5100
+++ b/test/log/5100
@@ -86,12 +86,12 @@ DATA
QUIT
<<< QUIT
250 OK
-1999-03-02 09:44:33 10HmbD-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbD-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbD-0005vi-00 == jack@myhost.test.ex R=smartuser T=lmtp defer (-46): LMTP error after end of data: 450 Number 2 is now delayed
1999-03-02 09:44:33 10HmbD-0005vi-00 ** jill@myhost.test.ex R=smartuser T=lmtp: LMTP error after end of data: 550 Number 3 is now rejected
1999-03-02 09:44:33 10HmbD-0005vi-00 == tom@myhost.test.ex R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<tom@myhost.test.ex>: 450 This one is delayed on RCPT
1999-03-02 09:44:33 10HmbD-0005vi-00 ** dick@myhost.test.ex R=smartuser T=lmtp: LMTP error after RCPT TO:<dick@myhost.test.ex>: 550 This one is unknown on RCPT
-1999-03-02 09:44:33 10HmbD-0005vi-00 -> harry <harry@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbD-0005vi-00 -> harry <harry@myhost.test.ex> R=smartuser T=lmtp C="250 Number 6 is OK"
1999-03-02 09:44:33 10HmbE-0005vi-00 <= <> R=10HmbD-0005vi-00 U=EXIMUSER P=local S=sss
1999-03-02 09:44:33 10HmbE-0005vi-00 => :blackhole: <CALLER@myhost.test.ex> R=bounces
1999-03-02 09:44:33 10HmbE-0005vi-00 Completed
@@ -137,7 +137,7 @@ DATA
<<< This is a test message.
<<< .
250 Number 1 is OK
-1999-03-02 09:44:33 10HmbF-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbF-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbF-0005vi-00 == jack@myhost.test.ex R=smartuser T=lmtp defer (-1): LMTP timeout after end of data (ddd bytes written)
1999-03-02 09:44:33 10HmbF-0005vi-00 == jill@myhost.test.ex R=smartuser T=lmtp defer (-1): LMTP timeout after end of data (ddd bytes written)
1999-03-02 09:44:33 10HmbF-0005vi-00 == tom@myhost.test.ex R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<tom@myhost.test.ex>: 450 This one is delayed on RCPT
@@ -214,8 +214,8 @@ DATA
QUIT
<<< QUIT
220 OK
-1999-03-02 09:44:33 10HmbI-0005vi-00 => jack <jack@myhost.test.ex> R=smartuser T=lmtp
-1999-03-02 09:44:33 10HmbI-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbI-0005vi-00 => jack <jack@myhost.test.ex> R=smartuser T=lmtp C="250 OK"
+1999-03-02 09:44:33 10HmbI-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp C="250 OK"
1999-03-02 09:44:33 10HmbI-0005vi-00 Completed
1999-03-02 09:44:33 10HmbJ-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
220 Welcome to this LMTP simulation
@@ -252,8 +252,8 @@ DATA
QUIT
<<< QUIT
220 OK
-1999-03-02 09:44:33 10HmbJ-0005vi-00 => jack <jack@myhost.test.ex> R=smartuser T=lmtp
-1999-03-02 09:44:33 10HmbJ-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbJ-0005vi-00 => jack <jack@myhost.test.ex> R=smartuser T=lmtp C="250 OK"
+1999-03-02 09:44:33 10HmbJ-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp C="250 OK"
1999-03-02 09:44:33 10HmbJ-0005vi-00 Completed
1999-03-02 09:44:33 10HmbK-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
220 Welcome to this LMTP simulation
diff --git a/test/log/5101 b/test/log/5101
index a24a5aae8..091db6679 100644
--- a/test/log/5101
+++ b/test/log/5101
@@ -37,9 +37,9 @@ DATA
QUIT
<<< QUIT
250 OK
-1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmaX-0005vi-00 ** jack@myhost.test.ex R=smartuser T=lmtp: LMTP error after end of data: 550 Number 2 fails
-1999-03-02 09:44:33 10HmaX-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery
+1999-03-02 09:44:33 10HmaX-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery C="250 Number 3 is OK"
1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> R=10HmaX-0005vi-00 U=EXIMUSER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 => CALLER <CALLER@myhost.test.ex> R=bounces T=local_delivery
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
@@ -82,9 +82,9 @@ DATA
QUIT
<<< QUIT
250 OK
-1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery (mailbox TESTSUITE/test-mail/ has too many links (2))
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery (mailbox TESTSUITE/test-mail/ has too many links (2)) C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmaZ-0005vi-00 ** jack@myhost.test.ex R=smartuser T=lmtp: LMTP error after end of data: 550 Number 2 fails
-1999-03-02 09:44:33 10HmaZ-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery (mailbox TESTSUITE/test-mail/ has too many links (2))
+1999-03-02 09:44:33 10HmaZ-0005vi-00 -> jill <jill@myhost.test.ex> R=smartuser T=lmtp ST=local_delivery (mailbox TESTSUITE/test-mail/ has too many links (2)) C="250 Number 3 is OK"
1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> R=10HmaZ-0005vi-00 U=EXIMUSER P=local S=sss
1999-03-02 09:44:33 10HmbA-0005vi-00 => CALLER <CALLER@myhost.test.ex> R=bounces T=local_delivery
1999-03-02 09:44:33 10HmbA-0005vi-00 Completed
diff --git a/test/log/5102 b/test/log/5102
index 66076a0b0..ea6a0bfb7 100644
--- a/test/log/5102
+++ b/test/log/5102
@@ -1,5 +1,5 @@
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 => userx <userx@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@myhost.test.ex> R=smartuser T=lmtp C="250 OK"
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 == userx@myhost.test.ex R=smartuser T=lmtp defer (-1): LMTP timeout after initial connection
@@ -14,12 +14,12 @@
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
1999-03-02 09:44:33 End queue run: pid=pppp -qf
1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmbA-0005vi-00 => lp1 <lp1@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbA-0005vi-00 => lp1 <lp1@myhost.test.ex> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbA-0005vi-00 == lp2@myhost.test.ex R=smartuser T=lmtp defer (-46): LMTP error after end of data: 450 Number 2 is now delayed
1999-03-02 09:44:33 10HmbA-0005vi-00 ** lp3@myhost.test.ex R=smartuser T=lmtp: LMTP error after end of data: 550 Number 3 is now rejected
1999-03-02 09:44:33 10HmbA-0005vi-00 == lp4@myhost.test.ex R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<lp4@myhost.test.ex>: 450 This one is delayed on RCPT
1999-03-02 09:44:33 10HmbA-0005vi-00 ** lp5@myhost.test.ex R=smartuser T=lmtp: LMTP error after RCPT TO:<lp5@myhost.test.ex>: 550 This one is unknown on RCPT
-1999-03-02 09:44:33 10HmbA-0005vi-00 -> lp6 <lp6@myhost.test.ex> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbA-0005vi-00 -> lp6 <lp6@myhost.test.ex> R=smartuser T=lmtp C="250 Number 6 is OK"
1999-03-02 09:44:33 10HmbB-0005vi-00 <= <> R=10HmbA-0005vi-00 U=EXIMUSER P=local S=sss
1999-03-02 09:44:33 10HmbB-0005vi-00 => :blackhole: <CALLER@myhost.test.ex> R=bounces
1999-03-02 09:44:33 10HmbB-0005vi-00 Completed