Gitweb:
http://git.exim.org/exim.git/commitdiff/76f44207fdf9cc3360a131a2297e6fa33080e323
Commit: 76f44207fdf9cc3360a131a2297e6fa33080e323
Parent: 72c9e342b1a4a410efc165a38281da2f5b69ad90
Author: Wolfgang Breyha <wbreyha@???>
AuthorDate: Wed Mar 5 19:33:04 2014 +0000
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Wed Mar 5 19:54:19 2014 +0000
Support log_selector smtp_confirmation for the lmtp transport. Bug 1157
---
doc/doc-docbook/spec.xfpt | 3 ++-
doc/doc-txt/ChangeLog | 2 ++
src/src/deliver.c | 35 +++++++++++++++++++----------------
src/src/transports/lmtp.c | 8 +++++++-
test/log/5100 | 14 +++++++-------
test/log/5101 | 8 ++++----
test/log/5102 | 6 +++---
7 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index ece837d..40384c3 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 082caa8..331842f 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 b1a3b4c..df93a11 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 06eb729..7a1e7c4 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 ec4a807..5c4f5ce 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@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbD-0005vi-00 => userx <userx@???> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbD-0005vi-00 == jack@??? 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@??? 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@??? R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<tom@???>: 450 This one is delayed on RCPT
1999-03-02 09:44:33 10HmbD-0005vi-00 ** dick@??? R=smartuser T=lmtp: LMTP error after RCPT TO:<dick@???>: 550 This one is unknown on RCPT
-1999-03-02 09:44:33 10HmbD-0005vi-00 -> harry <harry@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbD-0005vi-00 -> harry <harry@???> 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@???> 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@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbF-0005vi-00 => userx <userx@???> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbF-0005vi-00 == jack@??? 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@??? 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@??? R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<tom@???>: 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@???> R=smartuser T=lmtp
-1999-03-02 09:44:33 10HmbI-0005vi-00 -> jill <jill@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbI-0005vi-00 => jack <jack@???> R=smartuser T=lmtp C="250 OK"
+1999-03-02 09:44:33 10HmbI-0005vi-00 -> jill <jill@???> 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@??? 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@???> R=smartuser T=lmtp
-1999-03-02 09:44:33 10HmbJ-0005vi-00 -> jill <jill@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbJ-0005vi-00 => jack <jack@???> R=smartuser T=lmtp C="250 OK"
+1999-03-02 09:44:33 10HmbJ-0005vi-00 -> jill <jill@???> 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@??? U=CALLER P=local S=sss
220 Welcome to this LMTP simulation
diff --git a/test/log/5101 b/test/log/5101
index a24a5aa..091db66 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@???> R=smartuser T=lmtp ST=local_delivery
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@???> R=smartuser T=lmtp ST=local_delivery C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmaX-0005vi-00 ** jack@??? 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@???> R=smartuser T=lmtp ST=local_delivery
+1999-03-02 09:44:33 10HmaX-0005vi-00 -> jill <jill@???> 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@???> 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@???> 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@???> 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@??? 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@???> 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@???> 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@???> 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 66076a0..ea6a0bf 100644
--- a/test/log/5102
+++ b/test/log/5102
@@ -1,5 +1,5 @@
1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@???> 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@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 == userx@??? 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@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmbA-0005vi-00 => lp1 <lp1@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbA-0005vi-00 => lp1 <lp1@???> R=smartuser T=lmtp C="250 Number 1 is OK"
1999-03-02 09:44:33 10HmbA-0005vi-00 == lp2@??? 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@??? 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@??? R=smartuser T=lmtp defer (-44): LMTP error after RCPT TO:<lp4@???>: 450 This one is delayed on RCPT
1999-03-02 09:44:33 10HmbA-0005vi-00 ** lp5@??? R=smartuser T=lmtp: LMTP error after RCPT TO:<lp5@???>: 550 This one is unknown on RCPT
-1999-03-02 09:44:33 10HmbA-0005vi-00 -> lp6 <lp6@???> R=smartuser T=lmtp
+1999-03-02 09:44:33 10HmbA-0005vi-00 -> lp6 <lp6@???> 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@???> R=bounces
1999-03-02 09:44:33 10HmbB-0005vi-00 Completed