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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
--- check_tcp.c.orig Thu Dec 9 13:01:37 2004
+++ check_tcp.c Thu Dec 9 16:52:52 2004
@@ -97,6 +97,7 @@
int use_ssl = FALSE;
int sd = 0;
char *buffer;
+int expect_mismatch_state = STATE_WARNING;
@@ -333,7 +334,7 @@
if (verbose)
printf ("%d %d\n", i, (int)server_expect_count);
if (i >= (int)server_expect_count)
- die (STATE_WARNING, _("Invalid response from host\n"));
+ die (expect_mismatch_state, _("Unexpected response from host: %s\n"), status);
if (strstr (status, server_expect[i]))
break;
}
@@ -416,6 +417,7 @@
{"jail", required_argument, 0, 'j'},
{"delay", required_argument, 0, 'd'},
{"refuse", required_argument, 0, 'r'},
+ {"mismatch", required_argument, 0, 'M'},
{"use-ipv4", no_argument, 0, '4'},
{"use-ipv6", no_argument, 0, '6'},
{"verbose", no_argument, 0, 'v'},
@@ -548,7 +550,17 @@
else if (!strncmp(optarg,"crit",4))
econn_refuse_state = STATE_CRITICAL;
else
- usage (_("Refuse mut be one of ok, warn, crit\n"));
+ usage (_("Refuse must be one of ok, warn, crit\n"));
+ break;
+ case 'M':
+ if (!strncmp(optarg,"ok",2))
+ expect_mismatch_state = STATE_OK;
+ else if (!strncmp(optarg,"warn",4))
+ expect_mismatch_state = STATE_WARNING;
+ else if (!strncmp(optarg,"crit",4))
+ expect_mismatch_state = STATE_CRITICAL;
+ else
+ usage (_("Mismatch must be one of ok, warn, crit\n"));
break;
case 'd':
if (is_intpos (optarg))
@@ -764,6 +776,8 @@
printf (_("\
-r, --refuse=ok|warn|crit\n\
Accept tcp refusals with states ok, warn, crit (default: crit)\n\
+ -M, --mismatch=ok|warn|crit\n\
+ Accept expect mismatches with states ok, warn, crit (default: warn)\n\
-j, --jail\n\
Hide output from TCP socket\n\
-m, --maxbytes=INTEGER\n\
@@ -798,8 +812,8 @@
Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
[-s <send string>] [-e <expect string>] [-q <quit string>]\n\
[-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
- [-r <refuse state>] [-v] [-4|-6] [-j] [-D <days to cert expiry>]\n\
- [-S <use SSL>]\n"), progname);
+ [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\
+ [-D <days to cert expiry>] [-S <use SSL>]\n"), progname);
printf (" %s (-h|--help)\n", progname);
printf (" %s (-V|--version)\n", progname);
}
|