[monitoring-plugins] Allow setting of port independent of argument ...
Lorenz Kästle
git at monitoring-plugins.org
Mon Mar 10 21:40:12 CET 2025
Module: monitoring-plugins
Branch: master
Commit: 6cd097921f0c5016fcae60b38dfb88c412e4bb20
Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
Date: Mon Mar 10 21:27:50 2025 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=6cd09792
Allow setting of port independent of argument position again
---
plugins/check_smtp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index fd492294..44b735f9 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -517,6 +517,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) {
int command_size = 0;
int response_size = 0;
bool implicit_tls = false;
+ int server_port_option = 0;
while (true) {
int opt_index = getopt_long(argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:sSD:F:A:U:P:q", longopts, &option);
@@ -534,7 +535,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) {
break;
case 'p': /* port */
if (is_intpos(optarg)) {
- result.config.server_port = atoi(optarg);
+ server_port_option = atoi(optarg);
} else {
usage4(_("Port must be a positive integer"));
}
@@ -710,6 +711,10 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) {
}
}
+ if (server_port_option != 0) {
+ result.config.server_port = server_port_option;
+ }
+
return result;
}
More information about the Commits
mailing list