Merge branch 'master' into check_swap_scanf_expressions

This commit is contained in:
Lorenz 2023-05-22 00:57:31 +02:00 committed by GitHub
commit 1bce93b28a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 36 deletions

View file

@ -5,13 +5,18 @@ 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
apt-add-repository non-free
apt-get update
source /etc/os-release
if [ ${ID} = "debian" ]; then
if [ -f /etc/apt/sources.list.d/debian.sources ]; then
sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources
else
apt-get update
apt-get -y install software-properties-common
apt-add-repository non-free
fi
fi
apt-get update
apt-get -y install perl \
autotools-dev \
libdbi-dev \
@ -83,7 +88,7 @@ cp tools/squid.conf /etc/squid/squid.conf
service squid start
# mariadb
service mariadb start
service mariadb start || service mysql start
mysql -e "create database IF NOT EXISTS test;" -uroot
# ldap

1
.gitignore vendored
View file

@ -246,6 +246,7 @@ NP-VERSION-FILE
/plugins-scripts/check_ircd
/plugins-scripts/check_log
/plugins-scripts/check_mailq
/plugins-scripts/check_mssql
/plugins-scripts/check_ntp
/plugins-scripts/check_oracle
/plugins-scripts/check_rpc

View file

@ -24,7 +24,7 @@
*
*****************************************************************************/
#include "common.h"
#include "../plugins/common.h"
#include <stdarg.h>
#include "utils_base.h"
#include <ctype.h>
@ -319,18 +319,18 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
while (1) {
/* Strip any leading space */
for (varlist; isspace(varlist[0]); varlist++);
for (; isspace(varlist[0]); varlist++);
if (strncmp(name, varlist, strlen(name)) == 0) {
varlist += strlen(name);
/* strip trailing spaces */
for (varlist; isspace(varlist[0]); varlist++);
for (; isspace(varlist[0]); varlist++);
if (varlist[0] == '=') {
/* We matched the key, go past the = sign */
varlist++;
/* strip leading spaces */
for (varlist; isspace(varlist[0]); varlist++);
for (; isspace(varlist[0]); varlist++);
if (tmp = index(varlist, sep)) {
/* Value is delimited by a comma */

View file

@ -470,10 +470,6 @@ int send_dhcp_discover(int sock){
packet_xid=random();
discover_packet.xid=htonl(packet_xid);
/**** WHAT THE HECK IS UP WITH THIS?!? IF I DON'T MAKE THIS CALL, ONLY ONE SERVER RESPONSE IS PROCESSED!!!! ****/
/* downright bizzarre... */
ntohl(discover_packet.xid);
/*discover_packet.secs=htons(65535);*/
discover_packet.secs=0xFF;

View file

@ -105,11 +105,11 @@ while test -n "$1"; do
case "$1" in
-h | --help)
print_help
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
-V | --version)
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
-F | --filename)
logfile=$2

View file

@ -86,20 +86,20 @@ esac
# Information options
case "$cmd" in
--help)
print_help
exit "$STATE_OK"
print_help
exit "$STATE_UNKNOWN"
;;
-h)
print_help
exit "$STATE_OK"
print_help
exit "$STATE_UNKNOWN"
;;
--version)
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_UNKNOWN"
;;
-V)
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_UNKNOWN"
;;
esac

View file

@ -26,19 +26,19 @@ print_help() {
case "$1" in
--help)
print_help
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
-h)
print_help
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
--version)
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
-V)
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
exit "$STATE_UNKNOWN"
;;
*)
sensordata=$(sensors 2>&1)

View file

@ -2217,11 +2217,10 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line)
if( strchr( p, '.' ) != NULL ) {
/* HTTP 1.x case */
char *ppp;
ppp = strtok( p, "." );
strtok( p, "." );
status_line->http_major = (int)strtol( p, &pp, 10 );
if( *pp != '\0' ) { free( first_line_buf ); return -1; }
ppp = strtok( NULL, " " );
strtok( NULL, " " );
status_line->http_minor = (int)strtol( p, &pp, 10 );
if( *pp != '\0' ) { free( first_line_buf ); return -1; }
p += 4; /* 1.x SP */

View file

@ -1391,7 +1391,6 @@ char *unchunk_content(const char *content) {
// https://en.wikipedia.org/wiki/Chunked_transfer_encoding
// https://www.rfc-editor.org/rfc/rfc7230#section-4.1
char *result = NULL;
size_t content_length = strlen(content);
char *start_of_chunk;
char* end_of_chunk;
long size_of_chunk;

View file

@ -551,7 +551,7 @@ print_help (void)
printf (" %s\n", _("Exit with CRITICAL status if slave server is more then INTEGER seconds"));
printf (" %s\n", _("behind master"));
printf (" %s\n", "-l, --ssl");
printf (" %s\n", _("Use ssl encryptation"));
printf (" %s\n", _("Use ssl encryption"));
printf (" %s\n", "-C, --ca-cert=STRING");
printf (" %s\n", _("Path to CA signing the cert"));
printf (" %s\n", "-a, --cert=STRING");

View file

@ -341,7 +341,7 @@ int main(int argc, char **argv){
2) If the counter you're going to measure is percent-based, the code will detect
the percent sign in its name and will attribute minimum (0%) and maximum (100%)
values automagically, as well the ¨%" sign to graph units.
values automagically, as well the "%" sign to graph units.
3) OTOH, if the counter is "absolute", you'll have to provide the following
the counter unit - that is, the dimensions of the counter you're getting. Examples:

View file

@ -517,7 +517,10 @@ print_help (void)
printf (" %s\n", _("connecting to the server. The result from the query has to be numeric."));
printf (" %s\n", _("Multiple SQL commands, separated by semicolon, are allowed but the result "));
printf (" %s\n", _("of the last command is taken into account only. The value of the first"));
printf (" %s\n\n", _("column in the first row is used as the check result."));
printf (" %s\n", _("column in the first row is used as the check result. If a second column is"));
printf (" %s\n", _("present in the result set, this is added to the plugin output with a"));
printf (" %s\n", _("prefix of \"Extra Info:\". This information can be displayed in the system"));
printf (" %s\n\n", _("executing the plugin."));
printf (" %s\n", _("See the chapter \"Monitoring Database Activity\" of the PostgreSQL manual"));
printf (" %s\n\n", _("for details about how to access internal statistics of the database server."));
@ -557,6 +560,7 @@ do_query (PGconn *conn, char *query)
PGresult *res;
char *val_str;
char *extra_info;
double value;
char *endptr = NULL;
@ -621,6 +625,12 @@ do_query (PGconn *conn, char *query)
printf ("|query=%f;%s;%s;;\n", value,
query_warning ? query_warning : "",
query_critical ? query_critical : "");
if (PQnfields (res) > 1) {
extra_info = PQgetvalue (res, 0, 1);
if (extra_info != NULL) {
printf ("Extra Info: %s\n", extra_info);
}
}
return my_status;
}

View file

@ -44,6 +44,8 @@
# include <sys/wait.h>
#endif
#include "./utils.h"
/** macros **/
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)