From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../264173-check_http-PostFromFile.patch | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 web/attachments/264173-check_http-PostFromFile.patch (limited to 'web/attachments/264173-check_http-PostFromFile.patch') diff --git a/web/attachments/264173-check_http-PostFromFile.patch b/web/attachments/264173-check_http-PostFromFile.patch new file mode 100644 index 0000000..2fe2102 --- /dev/null +++ b/web/attachments/264173-check_http-PostFromFile.patch @@ -0,0 +1,98 @@ +--- check_http.c.orig 2008-01-29 10:58:01.000000000 -0500 ++++ check_http.c 2008-01-29 11:01:47.000000000 -0500 +@@ -122,6 +122,7 @@ + int max_depth = 15; + char *http_method; + char *http_post_data; ++char *http_post_datafile; + char *http_content_type; + char buffer[MAX_INPUT_BUFFER]; + +@@ -175,6 +176,9 @@ + { + int c = 1; + char *p; ++ FILE *fp; ++ char input_buffer[MAX_INPUT_BUFFER]; ++ int first; + + enum { + INVERT_REGEX = CHAR_MAX + 1 +@@ -187,6 +191,7 @@ + {"nohtml", no_argument, 0, 'n'}, + {"ssl", no_argument, 0, 'S'}, + {"post", required_argument, 0, 'P'}, ++ {"postfile", required_argument, 0, 'F'}, + {"IP-address", required_argument, 0, 'I'}, + {"url", required_argument, 0, 'u'}, + {"port", required_argument, 0, 'p'}, +@@ -228,7 +233,7 @@ + } + + while (1) { +- c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); ++ c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:F:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); + if (c == -1 || c == EOF) + break; + +@@ -349,6 +354,11 @@ + http_method = strdup("POST"); + http_post_data = strdup (optarg); + break; ++ case 'F': /* HTTP POST data from file in URL encoded format */ ++ if (http_method || http_post_datafile) break; ++ http_method = strdup("POST"); ++ http_post_datafile = strdup (optarg); ++ break; + case 's': /* string or substring */ + strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); + string_expect[MAX_INPUT_BUFFER - 1] = 0; +@@ -439,6 +449,30 @@ + } + + c = optind; ++ ++ /* If user asked to read POST data from file, check for file existence then read content */ ++ ++ if (http_post_datafile != NULL) { ++ fp = fopen(http_post_datafile,"r"); ++ if (fp == NULL) ++ usage4 (_("Unable to open POST data file\n")); ++ ++ first=1; ++ while (fgets(input_buffer,MAX_INPUT_BUFFER,fp)) { ++ input_buffer[strlen(input_buffer)-1] = '\0'; /* strip newline */ ++ if (first == 1) { ++ first=0; ++ asprintf (&http_post_data, "%s\r\n", input_buffer); ++ } else { ++ asprintf (&http_post_data, "%s%s\r\n", http_post_data, input_buffer); ++ } ++ } ++ ++ fclose(fp); ++ } ++ ++ /* End of POST data file addition */ ++ + + if (server_address == NULL && c < argc) + server_address = strdup (argv[c++]); +@@ -1265,6 +1299,8 @@ + printf (" %s\n", _("URL to GET or POST (default: /)")); + printf (" %s\n", "-P, --post=STRING"); + printf (" %s\n", _("URL encoded http POST data")); ++ printf (" %s\n", "-F, --postfile=PATH"); ++ printf (" %s\n", _("file with URL-encoded http POST data")); + printf (" %s\n", "-N, --no-body"); + printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); + printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)")); +@@ -1341,7 +1377,7 @@ + printf (" %s -H | -I [-u ] [-p ]\n",progname); + printf (" [-w ] [-c ] [-t ] [-L]\n"); + printf (" [-a auth] [-f ] [-e ]\n"); +- printf (" [-s string] [-l] [-r | -R ] [-P string]\n"); ++ printf (" [-s string] [-l] [-r | -R ] [-P string | -F file]\n"); + printf (" [-m :] [-4|-6] [-N] [-M ] [-A string]\n"); + printf (" [-k string] [-S] [-C ] [-T ]\n"); + } -- cgit v1.2.3-74-g34f1