From e88a2889da629674368378411580363a4b403ce1 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 1 Feb 2023 13:10:17 +0000 Subject: Update release doc to recent versions diff --git a/doc/RELEASING.md b/doc/RELEASING.md index 58ec3e1..f40a84a 100644 --- a/doc/RELEASING.md +++ b/doc/RELEASING.md @@ -11,14 +11,14 @@ Before you start - Check Github Actions status. - Update local Git repository to the current `master` tip. For a - maintenance release (e.g., version 2.3.2), update to the current + maintenance release (e.g., version 2.3.3), update to the current `maint-2.3` tip, instead. Prepare and commit files ------------------------ - Update `configure.ac` and `NP-VERSION-GEN` with new version. -- Update `NEWS` from `git log --reverse v2.3.1..` output, and specify +- Update `NEWS` from `git log --reverse v2.3.2..` output, and specify the release version/date. - Update `AUTHORS` if there are new team members. - Update `THANKS.in` using `tools/update-thanks`. @@ -93,6 +93,6 @@ Announce new release If you want to mention the number of contributors in the announcement: - git shortlog -s v2.3.1..v2.4 | wc -l + git shortlog -s v2.3.2..v2.4 | wc -l -- cgit v0.10-9-g596f From 1a964086aacce594ea73a641620ccfdc98782105 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 1 Feb 2023 13:40:55 +0000 Subject: Preaparing Release 2.3.3 diff --git a/NEWS b/NEWS index b674391..83d522e 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,43 @@ This file documents the major additions and syntax changes between releases. +2.3.3 2nd Feb 2023 + ENHANCEMENTS + using PRId64 and PRIu64 instead of %ld directly + check_http: Make faster with larger files + check_snmp: add 'multiplier' to modify current value + check_http: Implement chunked encoding decoding + check_http/check_curl: add chunked encoding test + check_log: Added --exclude to exclude patterns + check_log: Add tests + check_disk: Clarify usage possibilites + + FIXES + fixed two PRId64 to PRIu64 in perfdata_uint64 + check_pgsql: Removing is_pg_dbname alltogether,using postgres API. + check_http: Remove superflous CRLF in HTTP-Requests + check_curl: detect ipv6 + check_icmp: fix parsing help/version long options + check_http: fix test plan + check_disk: Find accessible mount path if multiple are available + check_apt: Fix unknown escape sequence error output + check_curl: fix checking large bodys + check_snmp: Improve tests for check_snmp & multiply option + check_snmp: always apply format when applying multiplier + check_http: Use real booleans instead of ints + check_http: Document process_arguments a little bit better + check_http: Remove dead code + check_http: Fix several bug in the implementation of unchunking + check_http: Reformat a part to increase readability + check_apt: Put upgrade options in the root sections + check_apt: Fix comment + check_apt: Use real booleans + check_mailq: Fixing nullmailer regex + check_snmp: Fix regex matches + check_log: Fixed a bug when using --all + check_log: Cleaned up duplicated code in the args + check_http: Fix memory reallocation error in chunk decoding logic + check_http: Add space for ending NULL byte in array for chunked encoding + 2.3.2 20th Oct 2022 GENERAL Use netcat-openbsd for debian explicitely (by @RincewindsHat #1704) diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN index c353b1d..b4c8d24 100755 --- a/NP-VERSION-GEN +++ b/NP-VERSION-GEN @@ -6,7 +6,7 @@ SRC_ROOT=`dirname $0` NPVF=NP-VERSION-FILE -DEF_VER=2.3git +DEF_VER=2.3.3 LF=' ' diff --git a/THANKS.in b/THANKS.in index 8920140..73b3b3a 100644 --- a/THANKS.in +++ b/THANKS.in @@ -400,3 +400,8 @@ Peter Newman Tobias Fiebig Tobias Wiese Wolfgang Karall-Ahlborn +Danijel Tasov +Robert Bohne +Wolfgang Nieder +andrew bezella +Lorenz Gruenwald diff --git a/configure.ac b/configure.ac index 87a84a0..5f18695 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(monitoring-plugins,2.3git) +AC_INIT(monitoring-plugins,2.3.3) AC_CONFIG_SRCDIR(NPTest.pm) AC_CONFIG_FILES([gl/Makefile]) AC_CONFIG_AUX_DIR(build-aux) -- cgit v0.10-9-g596f From 0208994b9a7197961323fad45c2f2dd87e6645c7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 2 Feb 2023 10:21:40 +0000 Subject: Switch back to git version diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN index b4c8d24..c353b1d 100755 --- a/NP-VERSION-GEN +++ b/NP-VERSION-GEN @@ -6,7 +6,7 @@ SRC_ROOT=`dirname $0` NPVF=NP-VERSION-FILE -DEF_VER=2.3.3 +DEF_VER=2.3git LF=' ' diff --git a/configure.ac b/configure.ac index 5f18695..87a84a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(monitoring-plugins,2.3.3) +AC_INIT(monitoring-plugins,2.3git) AC_CONFIG_SRCDIR(NPTest.pm) AC_CONFIG_FILES([gl/Makefile]) AC_CONFIG_AUX_DIR(build-aux) -- cgit v0.10-9-g596f From fc8a233854c0d59cf637e982b84c836920d718bd Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 2 Feb 2023 10:24:40 +0000 Subject: Updating documentation to new version number diff --git a/doc/RELEASING.md b/doc/RELEASING.md index f40a84a..432b1da 100644 --- a/doc/RELEASING.md +++ b/doc/RELEASING.md @@ -2,7 +2,7 @@ Releasing a New Monitoring Plugins Version ========================================== Throughout this document, it is assumed that the current Monitoring -Plugins version is 2.3.2, and that we're about to publish version 2.4. +Plugins version is 2.3.3, and that we're about to publish version 2.4. It is also assumed that the official repository on GitHub is tracked using the remote name `monitoring-plugins` (rather than `origin`). @@ -11,14 +11,14 @@ Before you start - Check Github Actions status. - Update local Git repository to the current `master` tip. For a - maintenance release (e.g., version 2.3.3), update to the current + maintenance release (e.g., version 2.3.4), update to the current `maint-2.3` tip, instead. Prepare and commit files ------------------------ - Update `configure.ac` and `NP-VERSION-GEN` with new version. -- Update `NEWS` from `git log --reverse v2.3.2..` output, and specify +- Update `NEWS` from `git log --reverse v2.3.3..` output, and specify the release version/date. - Update `AUTHORS` if there are new team members. - Update `THANKS.in` using `tools/update-thanks`. @@ -93,6 +93,6 @@ Announce new release If you want to mention the number of contributors in the announcement: - git shortlog -s v2.3.2..v2.4 | wc -l + git shortlog -s v2.3.3..v2.4 | wc -l -- cgit v0.10-9-g596f From 843f17918886edd5c8d14e5a9967785c654053c8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 6 Feb 2023 05:45:36 +0000 Subject: Adding non-free source list (Closes: #1837) (due https://lists.debian.org/debian-devel-announce/2023/02/msg00000.html) diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index d8a76da..5222659 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -5,6 +5,7 @@ set -e export DEBIAN_FRONTEND=noninteractive +sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources apt-get update apt-get -y install software-properties-common if [ $(lsb_release -is) = "Debian" ]; then -- cgit v0.10-9-g596f From 6d3e44d2d8395076060e9c741e9b173dc5d57b76 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 6 Feb 2023 11:39:44 +0100 Subject: check_http: Handle chunked encoding without actual content correctly diff --git a/plugins/check_http.c b/plugins/check_http.c index 5fa310f..8dda046 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -1462,7 +1462,13 @@ char *unchunk_content(const char *content) { memcpy(result + (overall_size - size_of_chunk), start_of_chunk, size_of_chunk); } - result[overall_size] = '\0'; + if (overall_size == 0 && result == NULL) { + // We might just have received the end chunk without previous content, so result is never allocated + result = calloc(1, sizeof(char)); + // No error handling here, we can only return NULL anyway + } else { + result[overall_size] = '\0'; + } return result; } -- cgit v0.10-9-g596f From 03efbb8e4f736bf2df5d9477dd4191501fe035ea Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:15:46 +0100 Subject: check_http: Implement special case test for zero size chunk only diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index d766ac3..6078b27 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t @@ -9,12 +9,14 @@ use strict; use Test::More; use NPTest; use FindBin qw($Bin); +use IO::Socket::INET; $ENV{'LC_TIME'} = "C"; my $common_tests = 71; my $virtual_port_tests = 8; my $ssl_only_tests = 12; +my $chunked_encoding_special_tests = 1; # Check that all dependent modules are available eval "use HTTP::Daemon 6.01;"; plan skip_all => 'HTTP::Daemon >= 6.01 required' if $@; @@ -30,7 +32,7 @@ if ($@) { plan skip_all => "Missing required module for test: $@"; } else { if (-x "./$plugin") { - plan tests => $common_tests * 2 + $ssl_only_tests + $virtual_port_tests; + plan tests => $common_tests * 2 + $ssl_only_tests + $virtual_port_tests + $chunked_encoding_special_tests; } else { plan skip_all => "No $plugin compiled"; } @@ -51,6 +53,7 @@ my $port_http = 50000 + int(rand(1000)); my $port_https = $port_http + 1; my $port_https_expired = $port_http + 2; my $port_https_clientcert = $port_http + 3; +my $port_hacked_http = $port_http + 4; # This array keeps sockets around for implementing timeouts my @persist; @@ -72,6 +75,28 @@ if (!$pid) { } push @pids, $pid; +# Fork the hacked HTTP server +undef $pid; +$pid = fork; +defined $pid or die "Failed to fork"; +if (!$pid) { + # this is the fork + undef @pids; + my $socket = new IO::Socket::INET ( + LocalHost => '0.0.0.0', + LocalPort => $port_hacked_http, + Proto => 'tcp', + Listen => 5, + Reuse => 1 + ); + die "cannot create socket $!n" unless $socket; + my $local_sock = $socket->sockport(); + print "server waiting for client connection on port $local_sock\n"; + run_hacked_http_server ( $socket ); + die "hacked http server stopped"; +} +push @pids, $pid; + if (exists $servers->{https}) { # Fork a normal HTTPS server $pid = fork; @@ -207,6 +232,37 @@ sub run_server { } } +sub run_hacked_http_server { + my $socket = shift; + + # auto-flush on socket + $| = 1; + + + while(1) + { + # waiting for a new client connection + my $client_socket = $socket->accept(); + + # get information about a newly connected client + my $client_address = $client_socket->peerhost(); + my $client_portn = $client_socket->peerport(); + print "connection from $client_address:$client_portn"; + + # read up to 1024 characters from the connected client + my $data = ""; + $client_socket->recv($data, 1024); + print "received data: $data"; + + # write response data to the connected client + $data = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n\r\n"; + $client_socket->send($data); + + # notify client that response has been sent + shutdown($client_socket, 1); + } +} + END { foreach my $pid (@pids) { if ($pid) { print "Killing $pid\n"; kill "INT", $pid } @@ -222,6 +278,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") { my $result; my $command = "./$plugin -H 127.0.0.1"; +run_chunked_encoding_special_test( {command => "$command -p $port_hacked_http"}); run_common_tests( { command => "$command -p $port_http" } ); SKIP: { skip "HTTP::Daemon::SSL not installed", $common_tests + $ssl_only_tests if ! exists $servers->{https}; @@ -511,3 +568,14 @@ sub run_common_tests { }; is( $@, "", $cmd ); } + +sub run_chunked_encoding_special_test { + my ($opts) = @_; + my $command = $opts->{command}; + + $cmd = "$command -u / -s 'ChunkedEncodingSpecialTest'"; + eval { + $result = NPTest->testCmd( $cmd, 5 ); + }; + is( $@, "", $cmd ); +} -- cgit v0.10-9-g596f