diff options
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 859e3e35..a2c7571b 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -103,8 +103,6 @@ int server_expect_yn = 0; | |||
103 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; | 103 | char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; |
104 | char header_expect[MAX_INPUT_BUFFER] = ""; | 104 | char header_expect[MAX_INPUT_BUFFER] = ""; |
105 | char string_expect[MAX_INPUT_BUFFER] = ""; | 105 | char string_expect[MAX_INPUT_BUFFER] = ""; |
106 | char output_header_search[30] = ""; | ||
107 | char output_string_search[30] = ""; | ||
108 | char *warning_thresholds = NULL; | 106 | char *warning_thresholds = NULL; |
109 | char *critical_thresholds = NULL; | 107 | char *critical_thresholds = NULL; |
110 | thresholds *thlds; | 108 | thresholds *thlds; |
@@ -1236,8 +1234,10 @@ int check_http(void) { | |||
1236 | } | 1234 | } |
1237 | 1235 | ||
1238 | /* Page and Header content checks go here */ | 1236 | /* Page and Header content checks go here */ |
1239 | if (strlen(header_expect)) { | 1237 | if (strlen(header_expect) > 0) { |
1240 | if (!strstr(header, header_expect)) { | 1238 | if (strstr(header, header_expect) == NULL) { |
1239 | // We did not find the header, the rest is for building the output and setting the state | ||
1240 | char output_header_search[30] = ""; | ||
1241 | strncpy(&output_header_search[0], header_expect, | 1241 | strncpy(&output_header_search[0], header_expect, |
1242 | sizeof(output_header_search)); | 1242 | sizeof(output_header_search)); |
1243 | if (output_header_search[sizeof(output_header_search) - 1] != '\0') { | 1243 | if (output_header_search[sizeof(output_header_search) - 1] != '\0') { |
@@ -1254,6 +1254,8 @@ int check_http(void) { | |||
1254 | 1254 | ||
1255 | if (strlen(string_expect)) { | 1255 | if (strlen(string_expect)) { |
1256 | if (!strstr(page, string_expect)) { | 1256 | if (!strstr(page, string_expect)) { |
1257 | // We found the string the body, the rest is for building the output | ||
1258 | char output_string_search[30] = ""; | ||
1257 | strncpy(&output_string_search[0], string_expect, | 1259 | strncpy(&output_string_search[0], string_expect, |
1258 | sizeof(output_string_search)); | 1260 | sizeof(output_string_search)); |
1259 | if (output_string_search[sizeof(output_string_search) - 1] != '\0') { | 1261 | if (output_string_search[sizeof(output_string_search) - 1] != '\0') { |
@@ -1268,7 +1270,7 @@ int check_http(void) { | |||
1268 | } | 1270 | } |
1269 | } | 1271 | } |
1270 | 1272 | ||
1271 | if (strlen(regexp)) { | 1273 | if (strlen(regexp) > 0) { |
1272 | errcode = regexec(&preg, page, REGS, pmatch, 0); | 1274 | errcode = regexec(&preg, page, REGS, pmatch, 0); |
1273 | if ((errcode == 0 && invert_regex == 0) || | 1275 | if ((errcode == 0 && invert_regex == 0) || |
1274 | (errcode == REG_NOMATCH && invert_regex == 1)) { | 1276 | (errcode == REG_NOMATCH && invert_regex == 1)) { |