Gitweb:
http://git.exim.org/exim.git/commitdiff/887291d23b561d0bb8cf43db80c191810e2d8ce3
Commit: 887291d23b561d0bb8cf43db80c191810e2d8ce3
Parent: 14ea0bea67dc606a55b1a7c29ce7e8595bd86f64
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Apr 18 14:21:59 2014 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Sat Apr 19 15:28:05 2014 +0100
Fix logging of nomail
When built with TLS support, non-TLS connections not resulting in mail transfer were crashing while
building a log line. Fix by not returning a non-extensible string from the routine added in 67d81c1.
---
src/src/smtp_in.c | 22 ++++++++++++++++------
test/log/0547 | 1 +
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index fbfe1ed..2a3873d 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1164,6 +1164,15 @@ return string_sprintf("SMTP connection from %s", hostname);
#ifdef SUPPORT_TLS
+/* Append TLS-related information to a log line
+
+Arguments:
+ s String under construction: allocated string to extend, or NULL
+ sizep Pointer to current allocation size (update on return), or NULL
+ ptrp Pointer to index for new entries in string (update on return), or NULL
+
+Returns: Allocated string or NULL
+*/
static uschar *
s_tlslog(uschar * s, int * sizep, int * ptrp)
{
@@ -1189,8 +1198,6 @@ s_tlslog(uschar * s, int * sizep, int * ptrp)
if (sizep) *sizep = size;
if (ptrp) *ptrp = ptr;
}
- else
- s = US"";
return s;
}
#endif
@@ -2715,14 +2722,17 @@ the connection is not forcibly to be dropped, return 0. Otherwise, log why it
is closing if required and return 2. */
if (log_reject_target != 0)
- log_write(0, log_reject_target, "%s%s %s%srejected %s%s",
- host_and_ident(TRUE),
+ {
#ifdef SUPPORT_TLS
- s_tlslog(NULL, NULL, NULL),
+ uschar * s = s_tlslog(NULL, NULL, NULL);
+ if (!s) s = US"";
#else
- "",
+ uschar * s = US"";
#endif
+ log_write(0, log_reject_target, "%s%s %s%srejected %s%s",
+ host_and_ident(TRUE), s,
sender_info, (rc == FAIL)? US"" : US"temporarily ", what, log_msg);
+ }
if (!drop) return 0;
diff --git a/test/log/0547 b/test/log/0547
index 6a5b233..3b86d2b 100644
--- a/test/log/0547
+++ b/test/log/0547
@@ -1,4 +1,5 @@
1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 no MAIL in SMTP connection from [127.0.0.1] D=0s
1999-03-02 09:44:33 no MAIL in SMTP connection from [127.0.0.1] D=0s C=QUIT
1999-03-02 09:44:33 H=(x.y.z) [127.0.0.1] rejected VRFY a@???
1999-03-02 09:44:33 no MAIL in SMTP connection from (x.y.z) [127.0.0.1] D=0s C=EHLO,VRFY,QUIT