[monitoring-plugins] check_smtp: fix positional host logic

Lorenz Kästle git at monitoring-plugins.org
Mon Mar 10 21:40:12 CET 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 5cf53de34fa410702ca59437cdf3f304366c3c55
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Mon Mar 10 20:56:09 2025 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=5cf53de3

check_smtp: fix positional host logic

---

 plugins/check_smtp.c          | 2 ++
 plugins/check_smtp.d/config.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 324549d4..fd492294 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -697,6 +697,8 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) {
 			} else {
 				usage2(_("Invalid hostname/address"), argv[c]);
 			}
+		} else {
+			result.config.server_address = strdup("localhost");
 		}
 	}
 
diff --git a/plugins/check_smtp.d/config.h b/plugins/check_smtp.d/config.h
index c8660445..0a6511ef 100644
--- a/plugins/check_smtp.d/config.h
+++ b/plugins/check_smtp.d/config.h
@@ -52,7 +52,7 @@ typedef struct {
 check_smtp_config check_smtp_config_init() {
 	check_smtp_config tmp = {
 		.server_port = SMTP_PORT,
-		.server_address = strdup("localhost"),
+		.server_address = NULL,
 		.localhostname = NULL,
 
 		.server_expect = SMTP_EXPECT,



More information about the Commits mailing list