Package: monitoring-plugins / 2.2-6

15_check_smtp_initialize Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 8520c643dd35bbeebbf36c7145d3f8c12dfaf70b Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@debian.org>
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));