summaryrefslogtreecommitdiffstats
path: root/plugins/check_smtp.c
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-05-25 12:33:24 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2006-05-25 12:33:24 +0000
commit5fd2550d4c96318b2de4a4a44e15e3c50c268e79 (patch)
treeb712838611281a444a9b603949352bc4003de657 /plugins/check_smtp.c
parent80e155c9cf826d977393ee130a07be599401335e (diff)
downloadmonitoring-plugins-5fd2550d4c96318b2de4a4a44e15e3c50c268e79.tar.gz
Use coreutils' regexp libraries, so regexp always available now
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1403 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r--plugins/check_smtp.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index e99f0675..3dc444fc 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -59,8 +59,7 @@ void print_help (void);
59void print_usage (void); 59void print_usage (void);
60int my_close(void); 60int my_close(void);
61 61
62#ifdef HAVE_REGEX_H 62#include "regex.h"
63#include <regex.h>
64char regex_expect[MAX_INPUT_BUFFER] = ""; 63char regex_expect[MAX_INPUT_BUFFER] = "";
65regex_t preg; 64regex_t preg;
66regmatch_t pmatch[10]; 65regmatch_t pmatch[10];
@@ -69,7 +68,6 @@ char errbuf[MAX_INPUT_BUFFER];
69int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 68int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
70int eflags = 0; 69int eflags = 0;
71int errcode, excode; 70int errcode, excode;
72#endif
73 71
74int server_port = SMTP_PORT; 72int server_port = SMTP_PORT;
75char *server_address = NULL; 73char *server_address = NULL;
@@ -308,7 +306,6 @@ main (int argc, char **argv)
308 printf("%s", buffer); 306 printf("%s", buffer);
309 strip (buffer); 307 strip (buffer);
310 if (n < nresponses) { 308 if (n < nresponses) {
311#ifdef HAVE_REGEX_H
312 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 309 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
313 errcode = regcomp (&preg, responses[n], cflags); 310 errcode = regcomp (&preg, responses[n], cflags);
314 if (errcode != 0) { 311 if (errcode != 0) {
@@ -329,12 +326,6 @@ main (int argc, char **argv)
329 printf (_("Execute Error: %s\n"), errbuf); 326 printf (_("Execute Error: %s\n"), errbuf);
330 result = STATE_UNKNOWN; 327 result = STATE_UNKNOWN;
331 } 328 }
332#else
333 if (strstr(buffer, responses[n])!=buffer) {
334 result = STATE_WARNING;
335 printf (_("SMTP %s - Invalid response '%s' to command '%s'\n"), state_text (result), buffer, commands[n]);
336 }
337#endif
338 } 329 }
339 n++; 330 n++;
340 } 331 }