From c032c3ecbd7320adf5572a2779b76fe5795e09fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 19 Jun 2026 11:26:50 +0200 Subject: [PATCH 1/4] check_smtp: set success value for auth check --- plugins/check_smtp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index e1f2842e..70ad41fe 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -481,6 +481,10 @@ int main(int argc, char **argv) { if (config.authtype != NULL) { mp_subcheck sc_auth = mp_subcheck_init(); + // set sucess values here, failure will be set below + sc_auth = mp_set_subcheck_default_state(sc_auth, STATE_OK); + xasprintf(&sc_auth.output, "Login succeded"); + if (strcmp(config.authtype, "LOGIN") == 0) { char *abuf; int ret; From 329a6f56cca4f9d30906ced6629f3cb0edfb551e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 19 Jun 2026 11:27:17 +0200 Subject: [PATCH 2/4] check_smtp: acutally use expected response test --- plugins/check_smtp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 70ad41fe..6b742d95 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -474,6 +474,8 @@ int main(int argc, char **argv) { xasprintf(&sc_expected_responses.output, "regexec execute error: %s", errbuf); sc_expected_responses = mp_set_subcheck_state(sc_expected_responses, STATE_UNKNOWN); } + + mp_add_subcheck_to_check(&overall, sc_expected_responses); } counter++; } From 6b0e4ff43fe482ae5de6f6f17c8e4bffc6690570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 19 Jun 2026 11:28:51 +0200 Subject: [PATCH 3/4] check_smtp: remove useless variable assignement --- plugins/check_smtp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 6b742d95..bb43f6a1 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -489,7 +489,6 @@ int main(int argc, char **argv) { if (strcmp(config.authtype, "LOGIN") == 0) { char *abuf; - int ret; do { /* send AUTH LOGIN */ my_send(config, SMTP_AUTH_LOGIN, strlen(SMTP_AUTH_LOGIN), socket_descriptor, @@ -499,8 +498,8 @@ int main(int argc, char **argv) { printf(_("sent %s\n"), "AUTH LOGIN"); } - if ((ret = recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, - ssl_established)) <= 0) { + if ((recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, + ssl_established)) <= 0) { xasprintf(&sc_auth.output, _("recv() failed after AUTH LOGIN")); sc_auth = mp_set_subcheck_state(sc_auth, STATE_WARNING); break; @@ -524,8 +523,8 @@ int main(int argc, char **argv) { printf(_("sent %s\n"), abuf); } - if ((ret = recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, - ssl_established)) <= 0) { + if ((recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, + ssl_established)) <= 0) { xasprintf(&sc_auth.output, "recv() failed after sending authuser"); sc_auth = mp_set_subcheck_state(sc_auth, STATE_CRITICAL); break; @@ -550,8 +549,8 @@ int main(int argc, char **argv) { printf(_("sent %s\n"), abuf); } - if ((ret = recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, - ssl_established)) <= 0) { + if ((recvlines(config, buffer, MAX_INPUT_BUFFER, socket_descriptor, + ssl_established)) <= 0) { xasprintf(&sc_auth.output, "recv() failed after sending authpass"); sc_auth = mp_set_subcheck_state(sc_auth, STATE_CRITICAL); break; From 2d894229dbd6217c1199032453e7c15faa1556d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:05:21 +0200 Subject: [PATCH 4/4] Fix typos --- plugins/check_smtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index bb43f6a1..45ea53e2 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -483,9 +483,9 @@ int main(int argc, char **argv) { if (config.authtype != NULL) { mp_subcheck sc_auth = mp_subcheck_init(); - // set sucess values here, failure will be set below + // set success values here, failure will be set below sc_auth = mp_set_subcheck_default_state(sc_auth, STATE_OK); - xasprintf(&sc_auth.output, "Login succeded"); + xasprintf(&sc_auth.output, "Login succeeded"); if (strcmp(config.authtype, "LOGIN") == 0) { char *abuf;