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. --- web/attachments/227858-check_httppatch.txt | 103 +++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 web/attachments/227858-check_httppatch.txt (limited to 'web/attachments/227858-check_httppatch.txt') diff --git a/web/attachments/227858-check_httppatch.txt b/web/attachments/227858-check_httppatch.txt new file mode 100644 index 0000000..08bf2ff --- /dev/null +++ b/web/attachments/227858-check_httppatch.txt @@ -0,0 +1,103 @@ +--- check_http.c 2007-03-06 14:45:57.000000000 -0800 ++++ - 2007-05-04 11:00:35.226089000 -0700 +@@ -110,7 +110,7 @@ + int http_opt_headers_count = 0; + int onredirect = STATE_OK; + int use_ssl = FALSE; +-int verbose = FALSE; ++int verbose = TRUE; + int sd; + int min_page_len = 0; + int max_page_len = 0; +@@ -751,6 +751,17 @@ + char *header; + char *page; + char *auth; ++/* Patched by T.P -- binary data */ ++ char bindata[MAX_INPUT_BUFFER]; ++ int bindatalen = 0; ++ int bindatafound = 0; ++ int bufpos=0; ++ int mybuflen=0; ++ char *pointer = http_post_data; ++ unsigned long ascii = 0; ++ char code[3] = {0}; ++ char *end = NULL; ++/* End patch */ + int http_status; + int i = 0; + size_t pagesize = 0; +@@ -800,14 +811,42 @@ + + /* either send http POST data */ + if (http_post_data) { ++/* Patched by T.P -- binary data */ ++ while (*pointer) { ++ if (*pointer == '%') { ++ /* Interpret the next two hex chars -- no error checking */ ++ memcpy(code,++pointer,2); ++ ascii = strtoul(code,&end,16); ++ bindata[bindatalen] = (char)ascii; ++ pointer += 2; ++ } else if (*pointer == '\\') { ++ /* Skip the escape char -- no error checking */ ++ pointer++; ++ bindata[bindatalen++] = *pointer++; ++ } else { ++ /* Just copy the char */ ++ bindata[bindatalen] = *pointer++; ++ } ++ bindatalen++; ++ } ++ /* Truncate the original string at the shorter length for future use */ ++ http_post_data[bindatalen] = (char)0; ++/* End patch */ + if (http_content_type) { + asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); + } else { + asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); + } + ++/* Patched by T.P -- binary data */ ++ /* original line + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); ++ */ ++ asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, bindatalen); ++ /* Print the original (ascii, truncated) string to fill space */ + asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); ++ bufpos = strlen(buf) - bindatalen - 2; ++/* End patch */ + } + else { + /* or just a newline so the server knows we're done with the request */ +@@ -815,13 +854,29 @@ + } + + if (verbose) printf ("%s\n", buf); +- my_send (buf, strlen (buf)); ++/* Patched by T.P -- binary data */ ++ if (bindatalen) { ++ mybuflen = strlen(buf); ++ /* Overwrite it with the (possibly) binary data */ ++ for (i=0;i 0) { ++ /* Original lines + buffer[i] = '\0'; + asprintf (&full_page, "%s%s", full_page, buffer); ++ */ ++ memcpy(pointer+pagesize,buffer,i); ++/* End patch */ + pagesize += i; + + if (no_body && document_headers_done (full_page)) { \ No newline at end of file -- cgit v1.2.3-74-g34f1