diff options
Diffstat (limited to 'web/attachments/154773-nagios_plugins-check_tcp.c.patch')
| -rw-r--r-- | web/attachments/154773-nagios_plugins-check_tcp.c.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/web/attachments/154773-nagios_plugins-check_tcp.c.patch b/web/attachments/154773-nagios_plugins-check_tcp.c.patch new file mode 100644 index 0000000..3d547df --- /dev/null +++ b/web/attachments/154773-nagios_plugins-check_tcp.c.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | --- ../../original_sources/nagios-plugins-1.4.2/plugins/check_tcp.c 2005-06-05 13:43:58.000000000 -0400 | ||
| 2 | +++ nagios-plugins-1.4.2/plugins/check_tcp.c 2005-11-02 10:21:56.000000000 -0500 | ||
| 3 | @@ -78,6 +78,8 @@ | ||
| 4 | static char *server_address = NULL; | ||
| 5 | static char *server_send = NULL; | ||
| 6 | static char *server_quit = NULL; | ||
| 7 | +static char *lineend = ""; | ||
| 8 | +static char *lineendquit = "\r\n"; | ||
| 9 | static char **server_expect; | ||
| 10 | static size_t server_expect_count = 0; | ||
| 11 | static size_t maxbytes = 0; | ||
| 12 | @@ -404,6 +406,7 @@ | ||
| 13 | {"timeout", required_argument, 0, 't'}, | ||
| 14 | {"protocol", required_argument, 0, 'P'}, | ||
| 15 | {"port", required_argument, 0, 'p'}, | ||
| 16 | + {"lineend", required_argument, 0, 'l'}, | ||
| 17 | {"send", required_argument, 0, 's'}, | ||
| 18 | {"expect", required_argument, 0, 'e'}, | ||
| 19 | {"maxbytes", required_argument, 0, 'm'}, | ||
| 20 | @@ -445,7 +448,7 @@ | ||
| 21 | } | ||
| 22 | |||
| 23 | while (1) { | ||
| 24 | - c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 25 | + c = getopt_long (argc, argv, "+hVv46H:l:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", | ||
| 26 | longopts, &option); | ||
| 27 | |||
| 28 | if (c == -1 || c == EOF || c == 1) | ||
| 29 | @@ -515,8 +518,30 @@ | ||
| 30 | else | ||
| 31 | server_port = atoi (optarg); | ||
| 32 | break; | ||
| 33 | + case 'l': | ||
| 34 | + switch (*optarg) { | ||
| 35 | + case 'n': | ||
| 36 | + lineend = "\n"; | ||
| 37 | + lineendquit = lineend; | ||
| 38 | + break; | ||
| 39 | + case 'r': | ||
| 40 | + lineend = "\r"; | ||
| 41 | + lineendquit = lineend; | ||
| 42 | + break; | ||
| 43 | + case 'b': | ||
| 44 | + lineend = "\r\n"; | ||
| 45 | + lineendquit = lineend; | ||
| 46 | + break; | ||
| 47 | + case 'e': | ||
| 48 | + lineend = ""; | ||
| 49 | + | ||
| 50 | + break; | ||
| 51 | + default: | ||
| 52 | + usage4 (_("Unrecognized option to -l not r, n, b or e.")); | ||
| 53 | + } | ||
| 54 | + break; | ||
| 55 | case 's': | ||
| 56 | - server_send = optarg; | ||
| 57 | + asprintf(&server_send, "%s%s", optarg, lineend); | ||
| 58 | break; | ||
| 59 | case 'e': /* expect string (may be repeated) */ | ||
| 60 | EXPECT = NULL; | ||
| 61 | @@ -533,7 +558,7 @@ | ||
| 62 | else | ||
| 63 | maxbytes = strtol (optarg, NULL, 0); | ||
| 64 | case 'q': | ||
| 65 | - asprintf(&server_quit, "%s\r\n", optarg); | ||
| 66 | + asprintf(&server_quit, "%s%s", optarg, lineendquit); | ||
| 67 | break; | ||
| 68 | case 'r': | ||
| 69 | if (!strncmp(optarg,"ok",2)) | ||
| 70 | @@ -738,6 +763,10 @@ | ||
| 71 | printf (_(UT_IPv46)); | ||
| 72 | |||
| 73 | printf (_("\ | ||
| 74 | + -l, --lineend=b|e|n|r\n\ | ||
| 75 | + Ending on -s nd -q strings. b - both: <cr><lf> style, e - empty no\n\ | ||
| 76 | + end, n - newline: newline end, r - return: carriage return end\n\ | ||
| 77 | + Default is \"-l e -s <send> -l b -q <quit>\".\n\ | ||
| 78 | -s, --send=STRING\n\ | ||
| 79 | String to send to the server\n\ | ||
| 80 | -e, --expect=STRING\n\ | ||
| 81 | @@ -783,6 +812,6 @@ | ||
| 82 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | ||
| 83 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | ||
| 84 | [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\ | ||
| 85 | - [-D <days to cert expiry>] [-S <use SSL>]\n", progname); | ||
| 86 | + [-D <days to cert expiry>] [-S <use SSL>] [-l <n|r|b|e>]\n", progname); | ||
| 87 | } | ||
| 88 | |||
