summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-12-10 16:19:16 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-12-10 16:19:16 +0000
commit4f7a93c27e3d43b44c42d3fc503f03b9b42ca622 (patch)
tree48ce964da76a3c72d792cab33448dc91bc780920 /src
parent4243a209fd9499f30bebd58ceaa2d0d9845407ae (diff)
downloadexim4-4f7a93c27e3d43b44c42d3fc503f03b9b42ca622.tar.gz
Allow a forced-fail for banner expansion to close connection without panic-log
Diffstat (limited to 'src')
-rw-r--r--src/src/smtp_in.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index b161f362d..6c043d434 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -3040,13 +3040,7 @@ code = US"220"; /* Default status code */
esc = US""; /* Default extended status code */
esclen = 0; /* Length of esc */
-if (!user_msg)
- {
- if (!(s = expand_string(smtp_banner)))
- log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Expansion of \"%s\" (smtp_banner) "
- "failed: %s", smtp_banner, expand_string_message);
- }
-else
+if (user_msg)
{
int codelen = 3;
s = user_msg;
@@ -3057,6 +3051,17 @@ else
esclen = codelen - 4;
}
}
+else if (!(s = expand_string(smtp_banner)))
+ {
+ log_write(0, f.expand_string_forcedfail ? LOG_MAIN : LOG_MAIN|LOG_PANIC_DIE,
+ "Expansion of \"%s\" (smtp_banner) failed: %s",
+ smtp_banner, expand_string_message);
+ /* for force-fail */
+#ifndef DISABLE_TLS
+ if (tls_in.on_connect) tls_close(NULL, TLS_SHUTDOWN_WAIT);
+#endif
+ return FALSE;
+ }
/* Remove any terminating newlines; might as well remove trailing space too */