From c8014631de0f7927d8c75ff87225b5a24e9b9942 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:25:29 +0100 Subject: check_tcp: add output if answer matches expectations --- plugins/check_tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 8cd86460..d1f6b84f 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -261,7 +261,7 @@ int main(int argc, char **argv) { #ifdef HAVE_SSL if (config.use_tls) { mp_subcheck tls_connection_result = mp_subcheck_init(); - int result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL)); + mp_state_enum result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL)); tls_connection_result = mp_set_subcheck_state(tls_connection_result, result); if (result == STATE_OK) { @@ -448,6 +448,10 @@ int main(int argc, char **argv) { expected_data_result = mp_set_subcheck_state(expected_data_result, config.expect_mismatch_state); xasprintf(&expected_data_result.output, "Answer failed to match expectation"); mp_add_subcheck_to_check(&overall, expected_data_result); + } else if (match == NP_MATCH_SUCCESS) { + expected_data_result = mp_set_subcheck_state(expected_data_result, STATE_OK); + xasprintf(&expected_data_result.output, "The answer of the server matched the expectation"); + mp_add_subcheck_to_check(&overall, expected_data_result); } /* reset the alarm */ -- cgit v1.2.3-74-g34f1