[monitoring-plugins] check_smtp: Restore behaviour pre ...

RincewindsHat git at monitoring-plugins.org
Sat Oct 21 11:50:13 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: decca6d290fb56adc0ef21525f14ea138aca6d45
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Thu Oct 19 11:31:28 2023 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=decca6d

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 d1c2466..986c3e1 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) {



More information about the Commits mailing list