[monitoring-plugins] check_smtp: remove restriction of --proxy with ...

Franz Schwartau git at monitoring-plugins.org
Tue Aug 29 17:00:12 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: da81dd3cf29c16ff1f9cf735482b9d4a0619f501
 Author: Franz Schwartau <franz at electromail.org>
   Date: Wed Jun 14 20:25:50 2023 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=da81dd3

check_smtp: remove restriction of --proxy with --ssl

---

 plugins/check_smtp.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 474557d..4ceb956 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -188,6 +188,13 @@ main (int argc, char **argv)
 	result = my_tcp_connect (server_address, server_port, &sd);
 
 	if (result == STATE_OK) { /* we connected */
+		/* If requested, send PROXY header */
+		if (use_proxy_prefix) {
+			if (verbose)
+				printf ("Sending header %s\n", PROXY_PREFIX);
+			my_send(PROXY_PREFIX, strlen(PROXY_PREFIX));
+		}
+
 #ifdef HAVE_SSL
 		if (use_ssl) {
 			result = np_net_ssl_init_with_hostname(sd, (use_sni ? server_address : NULL));
@@ -202,13 +209,6 @@ main (int argc, char **argv)
 		}
 #endif
 
-		/* If requested, send PROXY header */
-		if (use_proxy_prefix) {
-			if (verbose)
-				printf ("Sending header %s\n", PROXY_PREFIX);
-			my_send(PROXY_PREFIX, strlen(PROXY_PREFIX));
-		}
-
 		/* watch for the SMTP connection string and */
 		/* return a WARNING status if we couldn't read any data */
 		if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
@@ -718,10 +718,6 @@ process_arguments (int argc, char **argv)
 		usage4 (_("Set either -s/--ssl or -S/--starttls"));
 	}
 
-	if (use_ssl && use_proxy_prefix) {
-		usage4 (_("PROXY protocol (-r/--proxy) is not implemented with SSL/TLS (-s/--ssl), yet."));
-	}
-
 	return validate_arguments ();
 }
 



More information about the Commits mailing list