From decca6d290fb56adc0ef21525f14ea138aca6d45 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:31:28 +0200 Subject: check_smtp: Restore behaviour pre ead5526efa4f713e8001baed409067b0474cb72d regarding -D and TLS --- plugins/check_smtp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index d1c24666..986c3e18 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -480,6 +480,8 @@ process_arguments (int argc, char **argv) int c; char* temp; + bool implicit_tls = false; + enum { SNI_OPTION }; @@ -650,6 +652,8 @@ process_arguments (int argc, char **argv) #else usage (_("SSL support not available - install OpenSSL and recompile")); #endif + implicit_tls = true; + // fallthrough case 's': /* ssl */ use_ssl = true; @@ -717,7 +721,12 @@ process_arguments (int argc, char **argv) from_arg = strdup(" "); if (use_starttls && use_ssl) { - usage4 (_("Set either -s/--ssl/--tls or -S/--starttls")); + if (implicit_tls) { + use_ssl = false; + server_port = SMTP_PORT; + } else { + usage4 (_("Set either -s/--ssl/--tls or -S/--starttls")); + } } if (server_port_option != 0) { -- cgit v1.2.3-74-g34f1