diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-10 21:27:50 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-10 21:27:50 +0100 |
commit | 6cd097921f0c5016fcae60b38dfb88c412e4bb20 (patch) | |
tree | 8c630b47badc0a3b189457550475990003782d78 | |
parent | 3420d88a9c7436965f22a52790ffb8c793e2990f (diff) | |
download | monitoring-plugins-6cd09792.tar.gz |
Allow setting of port independent of argument position again
-rw-r--r-- | plugins/check_smtp.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) { | |||
517 | int command_size = 0; | 517 | int command_size = 0; |
518 | int response_size = 0; | 518 | int response_size = 0; |
519 | bool implicit_tls = false; | 519 | bool implicit_tls = false; |
520 | int server_port_option = 0; | ||
520 | while (true) { | 521 | while (true) { |
521 | int opt_index = getopt_long(argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:sSD:F:A:U:P:q", longopts, &option); | 522 | int opt_index = getopt_long(argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:sSD:F:A:U:P:q", longopts, &option); |
522 | 523 | ||
@@ -534,7 +535,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
534 | break; | 535 | break; |
535 | case 'p': /* port */ | 536 | case 'p': /* port */ |
536 | if (is_intpos(optarg)) { | 537 | if (is_intpos(optarg)) { |
537 | result.config.server_port = atoi(optarg); | 538 | server_port_option = atoi(optarg); |
538 | } else { | 539 | } else { |
539 | usage4(_("Port must be a positive integer")); | 540 | usage4(_("Port must be a positive integer")); |
540 | } | 541 | } |
@@ -710,6 +711,10 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
710 | } | 711 | } |
711 | } | 712 | } |
712 | 713 | ||
714 | if (server_port_option != 0) { | ||
715 | result.config.server_port = server_port_option; | ||
716 | } | ||
717 | |||
713 | return result; | 718 | return result; |
714 | } | 719 | } |
715 | 720 | ||