Merge branch 'master' into gnulib_update_2023

This commit is contained in:
Lorenz 2023-02-06 18:51:40 +01:00 committed by GitHub
commit 5a50b260ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 124 additions and 6 deletions

View file

@ -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

38
NEWS
View file

@ -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)

View file

@ -400,3 +400,8 @@ Peter Newman
Tobias Fiebig
Tobias Wiese
Wolfgang Karall-Ahlborn
Danijel Tasov
Robert Bohne
Wolfgang Nieder
andrew bezella
Lorenz Gruenwald

View file

@ -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.2), 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.1..` 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.1..v2.4 | wc -l
git shortlog -s v2.3.3..v2.4 | wc -l
<!-- vim:set filetype=markdown textwidth=72: -->

View file

@ -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;
}

View file

@ -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 );
}