From 4f75b28421bf1345b02e2e7a4f76c0b18d2921d3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 20 Jan 2019 15:17:59 +0100 Subject: [PATCH] Add d/p/15_check_smtp_initialize to fix check_smtp with custom commands and SSL Thanks to Iustin Pop ! (Closes: #886888) --- debian/patches/15_check_smtp_initialize | 26 +++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 debian/patches/15_check_smtp_initialize diff --git a/debian/patches/15_check_smtp_initialize b/debian/patches/15_check_smtp_initialize new file mode 100644 index 0000000..780c40b --- /dev/null +++ b/debian/patches/15_check_smtp_initialize @@ -0,0 +1,26 @@ +From 8520c643dd35bbeebbf36c7145d3f8c12dfaf70b Mon Sep 17 00:00:00 2001 +From: Iustin Pop +Date: Fri, 18 Jan 2019 22:52:54 +0100 +Subject: [PATCH] Simply initializes n before it is used + +When SSL is enabled, n is assigned the size of the server's second EHLO +response (I think in bytes), which will usually be significantly higher +than the command passed. As such, no commands are executed and no responses +are checked, which - silently - defeats the desired checks and results in a +success value. +--- + plugins/check_smtp.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c +index 0fcf4c68..d37c57c8 100644 +--- a/plugins/check_smtp.c ++++ b/plugins/check_smtp.c +@@ -293,6 +293,7 @@ main (int argc, char **argv) + printf("%s", buffer); + } + ++ n = 0; + while (n < ncommands) { + xasprintf (&cmd_str, "%s%s", commands[n], "\r\n"); + my_send(cmd_str, strlen(cmd_str)); diff --git a/debian/patches/series b/debian/patches/series index 1b24d63..9d505c6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,3 +5,4 @@ 12_check_apt_only_crit 13_check_apt_list_packages 14_mariadb +15_check_smtp_initialize