Andreas Baumann
ea53555f2d
check_curl: removed a superflous variable
2023-03-11 11:40:00 +01:00
Andreas Baumann
fc927e98db
fixed a wrong compare and a wrong size in strncat
2023-03-08 16:10:45 +01:00
Barak Shohat
2902381c5d
check_curl.c: Include all IPs from getaddrinfo() in curl DNS cache
2023-03-08 11:56:43 +02:00
Andreas Baumann
03f86b5d08
check_curl: in SSL host caching mode try to connect and bind and take the first getaddrinfo result which succeeds
2023-03-07 19:51:33 +01:00
Andreas Baumann
ad6b638acb
using real boolean in check_curl
2023-02-17 14:03:55 +01:00
Andreas Baumann
8e1bbf5e6e
changed #else/#if to #elif in libcurl library checks
2023-02-12 15:09:02 +01:00
Andreas Baumann
6563267c3a
fixed double frees when doing old-style redirects
2023-02-12 13:16:25 +01:00
Andreas Baumann
40da85e691
better cleanup of curl structures and buffers
2023-02-12 12:11:38 +01:00
Andreas Baumann
f6978deaa1
added --cookie-jar and doing proper cleanup of libcurl
2023-02-11 19:11:07 +01:00
Andreas Baumann
27b0c69645
fixed regerror is MAX_INPUT_BUFFER writting into too small errbuf
2023-02-11 18:39:24 +01:00
Andreas Baumann
f867d7b440
Merge branch 'master' into curlfixes
2023-02-11 07:20:24 +01:00
Lorenz
c07206f2cc
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
...
Gnulib update 2023 and attendant fixes
2023-02-10 11:43:20 +01:00
Lorenz
e92046f810
Merge pull request #1839 from monitoring-plugins/gnutlsfix
...
fallback to SSL_CTX_use_certificate_file for gnutls
2023-02-10 10:31:09 +01:00
Lorenz Kästle
28b5a1cc45
Make preprocessor fallback for gnutls more readable
2023-02-09 00:35:20 +01:00
Lorenz
5a50b260ee
Merge branch 'master' into gnulib_update_2023
2023-02-06 18:51:40 +01:00
Andreas Baumann
9734c439cb
Merge branch 'master' into curlfixes
2023-02-06 17:23:55 +01:00
RincewindsHat
03efbb8e4f
check_http: Implement special case test for zero size chunk only
2023-02-06 12:15:46 +01:00
RincewindsHat
6d3e44d2d8
check_http: Handle chunked encoding without actual content correctly
2023-02-06 11:39:44 +01:00
Andreas Baumann
53f07a468d
using CURLOPT_REDIR_PROTOCOLS_STR instead of CURLOPT_REDIR_PROTOCOLS for curl >= 7.85.0
2023-02-05 20:34:41 +01:00
Andreas Baumann
6f0ce3804a
fallback to SSL_CTX_use_certificate_file for gnutls
2023-02-04 16:19:46 +01:00
RincewindsHat
c4704e163e
sslutils.c: Move function after a function it uses to avoid forward declarations
2023-02-02 12:03:44 +01:00
Lorenz Kästle
f79eb4f2ca
Link plugins against libcrypto to make hashes available
2023-02-01 00:57:42 +01:00
Lorenz Kästle
05ab60f808
check_disk: Remove weird code (workaround?) which broke with gnulib update
2023-02-01 00:56:44 +01:00
Lorenz Kästle
d3fbcd1220
check_http: Add space for ending NULL byte in array for chunked encoding
2023-01-30 13:33:46 +01:00
Lorenz Kästle
d9528c265b
check_http: Fix memory reallocation error in chunk decoding logic
...
This patch should fix an error with the way memory reallocation was
used, which resulted in "realloc(): invalid next size".
It is not completely clear to me as to what caused this problem, but
apparently one can not depend handing a pointer to "realloc(3)" and
expect that it still works afterwards, but one should/must use the one
returned by the function.
Also this patch replaces a variable which was used to remember the
position in the array by just computing that from the current values.
2023-01-30 12:45:20 +01:00
Lorenz
67b472f9d1
check_disk: Clarify usage possibilites ( #1745 )
...
* Clarify usage possibilites of check_disk
* Remove superfluous newlines
Co-authored-by: waja <waja@users.noreply.github.com>
2023-01-20 12:08:15 +01:00
Sven Nierlein
f4930aee28
fix check_snmp regex matches
...
the multiplier function always tried to extract a number, even if the result
is a string because of using a mib.
before:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
oidname: IF-MIB::ifAdminStatus.11466
response: = INTEGER: up(1)
SNMP OK - 0 | IF-MIB::ifAdminStatus.11466=0;;
```
the regexp 0 matches, even if the actual result is "up(1)".
after this patch:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
oidname: IF-MIB::ifAdminStatus.11466
response: = INTEGER: up(1)
SNMP CRITICAL - *up(1)* |
```
2023-01-20 08:57:56 +01:00
waja
72147140ed
Fixing spelling errors ( #1826 )
2023-01-17 15:42:54 +01:00
Lorenz
0899e41f50
Check apt usage ( #1793 )
...
* Remove trailing whitespaces
* Use real booleans
* Fix comment
* Put upgrade options in the root sections
Co-authored-by: waja <waja@users.noreply.github.com>
2023-01-08 17:23:53 +01:00
Sven Nierlein
07561a67ab
tests: fix chunked encoding test server
2023-01-07 18:34:46 +01:00
Sven Nierlein
c256af44fb
check_http/check_curl: add chunked encoding test
2023-01-07 18:34:46 +01:00
RincewindsHat
6ed7a75c3b
Reformat a part to increase readability
2023-01-07 18:34:46 +01:00
RincewindsHat
67d1062530
Undo clang formatting
2023-01-07 18:34:46 +01:00
RincewindsHat
029168276f
Fix several bug in the implementation of unchunking
2023-01-07 18:34:46 +01:00
RincewindsHat
3e63e61f6a
Fix chunked header detection regex
2023-01-07 18:34:46 +01:00
RincewindsHat
1ac8f35301
Fix type of unchunk_content function declaration
2023-01-07 18:34:46 +01:00
RincewindsHat
48d6ef2557
Undo sorting of header file includes, it breaks the build
2023-01-07 18:34:46 +01:00
RincewindsHat
afe92468a5
Implement chunked encoding decoding
2023-01-07 18:34:46 +01:00
RincewindsHat
2c658383d5
Restructure code a bit to put things where they are actually needed
2023-01-07 18:34:46 +01:00
RincewindsHat
d4502f246f
Remove legacy comments and add some new ones
2023-01-07 18:34:46 +01:00
RincewindsHat
c0c096d2ef
Remove dead code
2023-01-07 18:34:46 +01:00
RincewindsHat
2315f59835
clang format
2023-01-07 18:34:46 +01:00
RincewindsHat
d2a05e0d12
Document process_arguments a little bit better
2023-01-07 18:34:46 +01:00
RincewindsHat
2752f91099
Update copyright
2023-01-07 18:34:46 +01:00
RincewindsHat
698eed58f8
Use real booleans instead of ints
2023-01-07 18:34:46 +01:00
Sven Nierlein
9ba8f5ed66
check_snmp: always apply format when applying multiplier
2022-12-22 12:54:51 +01:00
Robert Bohne
def946bd97
Improve tests for check_snmp & multiply option
2022-12-22 12:54:51 +01:00
Wolfgang Nieder
c35bf8966a
add 'multiplier' to modify current value
2022-12-22 12:54:51 +01:00
Sven Nierlein
765b29f09b
check_curl: fix checking large bodys ( #1823 )
...
check_curl fails on large pages:
HTTP CRITICAL - Invalid HTTP response received from host on port 5080: cURL returned 23 - Failure writing output to destination
for example trying to run check_curl on the test from #1822
I guess the idea is to double the buffer size each time it is to small. But the code
exponentially grows the buffer size which works well 2-3 times, but then fails.
2022-12-22 12:51:18 +01:00
Danijel Tasov
763862a61c
make check_http faster with larger files
...
The current implementation becomes exponentially slower with growing
response size.
See also:
https://github.com/nagios-plugins/nagios-plugins/blob/release-2.4.2/plugins/check_http.c#L1199-L1204
Test:
$ mkdir web
$ nohup python3 -m http.server -d web 5080 &
$ perl -E 'say "0123456789" for (1..2_000_000)' >| web/file.txt
$ ./check_http.orig -t 200 -v -I localhost -p 5080 -u /file.txt > test1.txt
real 0m26.893s
user 0m12.661s
sys 0m14.221s
$ time ./check_http -t 200 -v -I localhost -p 5080 -u /file.txt > test2.txt
real 0m0.038s
user 0m0.011s
sys 0m0.027s
$ diff -u test[12].txt
--- test1.txt 2022-12-21 14:58:28.720260811 +0100
+++ test2.txt 2022-12-21 14:58:42.640008604 +0100
@@ -7,7 +7,7 @@
STATUS: HTTP/1.0 200 OK
**** HEADER ****
Server: SimpleHTTP/0.6 Python/3.9.2
-Date: Wed, 21 Dec 2022 13:58:01 GMT
+Date: Wed, 21 Dec 2022 13:58:42 GMT
Content-type: text/plain
Content-Length: 22000000
Last-Modified: Wed, 21 Dec 2022 13:57:58 GMT
@@ -2000013,4 +2000013,4 @@
0123456789
0123456789
-HTTP OK: HTTP/1.0 200 OK - 22000191 bytes in 26.860 second response time |time=26.860182s;;;0.000000;200.000000 size=22000191B;;;0;
+HTTP OK: HTTP/1.0 200 OK - 22000191 bytes in 0.016 second response time |time=0.016412s;;;0.000000;200.000000 size=22000191B;;;0;
2022-12-22 10:15:59 +01:00