Droping all patches commited upstream and beeing obsolete with 2.3

This commit is contained in:
Jan Wagner 2020-12-10 21:28:06 +01:00
parent 3031044324
commit 61ef2d7fff
8 changed files with 0 additions and 800 deletions

View file

@ -1,376 +0,0 @@
From dbb92c347e8a19b3fbe33a9160776b7a16ea588b Mon Sep 17 00:00:00 2001
From: Jan Wagner <waja@cyconet.org>
Date: Wed, 30 Nov 2016 17:38:36 +0100
Subject: [PATCH] Spelling fixes suggested by lintian
---
plugins-root/check_icmp.c | 2 +-
plugins/check_fping.c | 2 +-
plugins/check_http.c | 2 +-
plugins/check_ide_smart.c | 2 +-
plugins/check_ldap.c | 2 +-
plugins/check_ntp.c | 4 ++--
plugins/check_ntp_peer.c | 2 +-
plugins/check_pgsql.c | 2 +-
plugins/check_radius.c | 2 +-
plugins/check_real.c | 2 +-
plugins/check_smtp.c | 2 +-
po/de.po | 22 +++++++++++-----------
po/fr.po | 12 ++++++------
po/monitoring-plugins.pot | 12 ++++++------
14 files changed, 35 insertions(+), 35 deletions(-)
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -608,7 +608,7 @@
if(max_completion_time > (u_int)timeout * 1000000) {
printf("max_completion_time: %llu timeout: %u\n",
max_completion_time, timeout);
- printf("Timout must be at lest %llu\n",
+ printf("Timeout must be at lest %llu\n",
max_completion_time / 1000000 + 1);
}
}
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -184,7 +184,7 @@
int status = STATE_UNKNOWN;
if (strstr (buf, "not found")) {
- die (STATE_CRITICAL, _("FPING UNKNOW - %s not found\n"), server_name);
+ die (STATE_CRITICAL, _("FPING UNKNOWN - %s not found\n"), server_name);
}
else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -1629,7 +1629,7 @@
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("This plugin will attempt to open an HTTP connection with the host."));
printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return STATE_CRITICAL"));
- printf (" %s\n", _("other errors return STATE_UNKNOWN. Successful connects, but incorrect reponse"));
+ printf (" %s\n", _("other errors return STATE_UNKNOWN. Successful connects, but incorrect response"));
printf (" %s\n", _("messages from the host result in STATE_WARNING return values. If you are"));
printf (" %s\n", _("checking a virtual server that uses 'host headers' you must supply the FQDN"));
printf (" %s\n", _("(fully qualified domain name) as the [host_name] argument."));
--- a/plugins/check_ide_smart.c
+++ b/plugins/check_ide_smart.c
@@ -283,7 +283,7 @@
return offline_status_text[i].text;
}
}
- return "UNKNOW";
+ return "UNKNOWN";
}
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -237,7 +237,7 @@
if(entries_thresholds != NULL) {
if (verbose) {
printf ("entries found: %d\n", num_entries);
- print_thresholds("entry threasholds", entries_thresholds);
+ print_thresholds("entry thresholds", entries_thresholds);
}
status_entries = get_status(num_entries, entries_thresholds);
if (status_entries == STATE_CRITICAL) {
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -548,7 +548,7 @@
DBG(print_ntp_control_message(&req));
/* Attempt to read the largest size packet possible */
req.count=htons(MAX_CM_SIZE);
- DBG(printf("recieving READSTAT response"))
+ DBG(printf("receiving READSTAT response"))
read(conn, &req, SIZEOF_NTPCM(req));
DBG(print_ntp_control_message(&req));
/* Each peer identifier is 4 bytes in the data section, which
@@ -608,7 +608,7 @@
DBG(print_ntp_control_message(&req));
req.count = htons(MAX_CM_SIZE);
- DBG(printf("recieving READVAR response...\n"));
+ DBG(printf("receiving READVAR response...\n"));
read(conn, &req, SIZEOF_NTPCM(req));
DBG(print_ntp_control_message(&req));
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -245,7 +245,7 @@
do {
/* Attempt to read the largest size packet possible */
req.count=htons(MAX_CM_SIZE);
- DBG(printf("recieving READSTAT response"))
+ DBG(printf("receiving READSTAT response"))
if(read(conn, &req, SIZEOF_NTPCM(req)) == -1)
die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
DBG(print_ntp_control_message(&req));
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
@@ -565,7 +565,7 @@
printf (" %s\n", _("Typically, the monitoring user (unless the --logname option is used) should be"));
printf (" %s\n", _("able to connect to the database without a password. The plugin can also send"));
- printf (" %s\n", _("a password, but no effort is made to obsure or encrypt the password."));
+ printf (" %s\n", _("a password, but no effort is made to obscure or encrypt the password."));
printf (UT_SUPPORT);
}
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -360,7 +360,7 @@
printf (" %s\n", "-u, --username=STRING");
printf (" %s\n", _("The user to authenticate"));
printf (" %s\n", "-p, --password=STRING");
- printf (" %s\n", _("Password for autentication (SECURITY RISK)"));
+ printf (" %s\n", _("Password for authentication (SECURITY RISK)"));
printf (" %s\n", "-n, --nas-id=STRING");
printf (" %s\n", _("NAS identifier"));
printf (" %s\n", "-N, --nas-ip-address=STRING");
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -438,7 +438,7 @@
printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host."));
printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return"));
printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,"));
- printf ("%s\n", _("but incorrect reponse messages from the host result in STATE_WARNING return"));
+ printf ("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return"));
printf ("%s\n", _("values."));
printf (UT_SUPPORT);
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -835,7 +835,7 @@
printf("\n");
printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return"));
printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful"));
- printf ("%s\n", _("connects, but incorrect reponse messages from the host result in"));
+ printf ("%s\n", _("connects, but incorrect response messages from the host result in"));
printf ("%s\n", _("STATE_WARNING return values."));
printf (UT_SUPPORT);
--- a/po/de.po
+++ b/po/de.po
@@ -717,7 +717,7 @@
#: plugins/check_dns.c:286
#, fuzzy, c-format
msgid "DNS UNKNOWN - %s\n"
-msgstr "DNS UNKNOW - %s\n"
+msgstr "DNS UNKNOWN - %s\n"
#: plugins/check_dns.c:299
msgid "Note: nslookup is deprecated and may be removed from future releases."
@@ -865,7 +865,7 @@
#: plugins/check_fping.c:157
#, fuzzy
msgid "FPING UNKNOWN - IP address not found\n"
-msgstr "FPING UNKNOW - %s nicht gefunden\n"
+msgstr "FPING UNKNOWN - %s nicht gefunden\n"
#: plugins/check_fping.c:160
msgid "FPING UNKNOWN - invalid commandline argument\n"
@@ -874,12 +874,12 @@
#: plugins/check_fping.c:163
#, fuzzy
msgid "FPING UNKNOWN - failed system call\n"
-msgstr "FPING UNKNOW - %s nicht gefunden\n"
+msgstr "FPING UNKNOWN - %s nicht gefunden\n"
#: plugins/check_fping.c:187
#, c-format
-msgid "FPING UNKNOW - %s not found\n"
-msgstr "FPING UNKNOW - %s nicht gefunden\n"
+msgid "FPING UNKNOWN - %s not found\n"
+msgstr "FPING UNKNOWN - %s nicht gefunden\n"
#: plugins/check_fping.c:191
#, c-format
@@ -889,7 +889,7 @@
#: plugins/check_fping.c:196
#, fuzzy, c-format
msgid "FPING UNKNOWN - %s parameter error\n"
-msgstr "FPING UNKNOW - %s nicht gefunden\n"
+msgstr "FPING UNKNOWN - %s nicht gefunden\n"
#: plugins/check_fping.c:200 plugins/check_fping.c:240
#, c-format
@@ -1603,7 +1603,7 @@
#: plugins/check_http.c:1632
msgid ""
"other errors return STATE_UNKNOWN. Successful connects, but incorrect "
-"reponse"
+"response"
msgstr ""
#: plugins/check_http.c:1633
@@ -3723,7 +3723,7 @@
msgstr ""
#: plugins/check_pgsql.c:568
-msgid "a password, but no effort is made to obsure or encrypt the password."
+msgid "a password, but no effort is made to obscure or encrypt the password."
msgstr ""
#: plugins/check_pgsql.c:601
@@ -4259,7 +4259,7 @@
msgstr ""
#: plugins/check_radius.c:363
-msgid "Password for autentication (SECURITY RISK)"
+msgid "Password for authentication (SECURITY RISK)"
msgstr ""
#: plugins/check_radius.c:365
@@ -4400,7 +4400,7 @@
#: plugins/check_real.c:441
msgid ""
-"but incorrect reponse messages from the host result in STATE_WARNING return"
+"but incorrect response messages from the host result in STATE_WARNING return"
msgstr ""
#: plugins/check_real.c:442
@@ -4616,7 +4616,7 @@
msgstr ""
#: plugins/check_smtp.c:838
-msgid "connects, but incorrect reponse messages from the host result in"
+msgid "connects, but incorrect response messages from the host result in"
msgstr ""
#: plugins/check_smtp.c:839
--- a/po/fr.po
+++ b/po/fr.po
@@ -915,7 +915,7 @@
#: plugins/check_fping.c:187
#, c-format
-msgid "FPING UNKNOW - %s not found\n"
+msgid "FPING UNKNOWN - %s not found\n"
msgstr "PING INCONNU - Hôte non trouvé (%s)\n"
#: plugins/check_fping.c:191
@@ -1650,7 +1650,7 @@
#: plugins/check_http.c:1632
msgid ""
"other errors return STATE_UNKNOWN. Successful connects, but incorrect "
-"reponse"
+"response"
msgstr ""
#: plugins/check_http.c:1633
@@ -3788,7 +3788,7 @@
msgstr ""
#: plugins/check_pgsql.c:568
-msgid "a password, but no effort is made to obsure or encrypt the password."
+msgid "a password, but no effort is made to obscure or encrypt the password."
msgstr ""
#: plugins/check_pgsql.c:601
@@ -4343,7 +4343,7 @@
msgstr ""
#: plugins/check_radius.c:363
-msgid "Password for autentication (SECURITY RISK)"
+msgid "Password for authentication (SECURITY RISK)"
msgstr ""
#: plugins/check_radius.c:365
@@ -4480,7 +4480,7 @@
#: plugins/check_real.c:441
msgid ""
-"but incorrect reponse messages from the host result in STATE_WARNING return"
+"but incorrect response messages from the host result in STATE_WARNING return"
msgstr ""
#: plugins/check_real.c:442
@@ -4693,7 +4693,7 @@
msgstr ""
#: plugins/check_smtp.c:838
-msgid "connects, but incorrect reponse messages from the host result in"
+msgid "connects, but incorrect response messages from the host result in"
msgstr ""
#: plugins/check_smtp.c:839
--- a/po/monitoring-plugins.pot
+++ b/po/monitoring-plugins.pot
@@ -854,7 +854,7 @@
#: plugins/check_fping.c:187
#, c-format
-msgid "FPING UNKNOW - %s not found\n"
+msgid "FPING UNKNOWN - %s not found\n"
msgstr ""
#: plugins/check_fping.c:191
@@ -1553,7 +1553,7 @@
#: plugins/check_http.c:1632
msgid ""
"other errors return STATE_UNKNOWN. Successful connects, but incorrect "
-"reponse"
+"response"
msgstr ""
#: plugins/check_http.c:1633
@@ -3629,7 +3629,7 @@
msgstr ""
#: plugins/check_pgsql.c:568
-msgid "a password, but no effort is made to obsure or encrypt the password."
+msgid "a password, but no effort is made to obscure or encrypt the password."
msgstr ""
#: plugins/check_pgsql.c:601
@@ -4153,7 +4153,7 @@
msgstr ""
#: plugins/check_radius.c:363
-msgid "Password for autentication (SECURITY RISK)"
+msgid "Password for authentication (SECURITY RISK)"
msgstr ""
#: plugins/check_radius.c:365
@@ -4287,7 +4287,7 @@
#: plugins/check_real.c:441
msgid ""
-"but incorrect reponse messages from the host result in STATE_WARNING return"
+"but incorrect response messages from the host result in STATE_WARNING return"
msgstr ""
#: plugins/check_real.c:442
@@ -4496,7 +4496,7 @@
msgstr ""
#: plugins/check_smtp.c:838
-msgid "connects, but incorrect reponse messages from the host result in"
+msgid "connects, but incorrect response messages from the host result in"
msgstr ""
#: plugins/check_smtp.c:839
From 89d00d1c009dd3d4d1c5a6c3769a27704ca3a154 Mon Sep 17 00:00:00 2001
From: Holger Weiss <holger@zedat.fu-berlin.de>
Date: Tue, 10 Jan 2017 21:34:58 +0100
Subject: [PATCH] Apply another spelling fix
---
plugins-root/check_icmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index b722f80..4098874 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -608,7 +608,7 @@ main(int argc, char **argv)
if(max_completion_time > (u_int)timeout * 1000000) {
printf("max_completion_time: %llu timeout: %u\n",
max_completion_time, timeout);
- printf("Timeout must be at lest %llu\n",
+ printf("Timeout must be at least %llu\n",
max_completion_time / 1000000 + 1);
}
}

View file

@ -1,22 +0,0 @@
From c7f7959dd90e2b82bb1904a02e11f4b5e0f35709 Mon Sep 17 00:00:00 2001
From: Harald Koch <chk@anemone.chk.cfrq.net>
Date: Wed, 7 Dec 2016 13:11:40 -0500
Subject: [PATCH] properly remove MSG_PEEK in check_dhcp.c. Fixes #1450.
---
plugins-root/check_dhcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 88b7ca1..f4c2daf 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -693,7 +693,7 @@ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, st
else{
bzero(&source_address,sizeof(source_address));
address_size=sizeof(source_address);
- recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size);
+ recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size);
if(verbose)
printf("recv_result: %d\n",recv_result);

View file

@ -1,123 +0,0 @@
From bf18dc42dd16811a3e0f42d4591604a4213afb3e Mon Sep 17 00:00:00 2001
From: Christian Schmidt <c960657@users.noreply.github.com>
Date: Thu, 29 Dec 2016 16:09:24 +0100
Subject: [PATCH] Add --only-critical switch to check_apt
---
plugins/check_apt.c | 15 ++++++++++++---
plugins/t/check_apt.t | 18 +++++++++++++++++-
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index a639a41..c90b3df 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -73,6 +73,7 @@ char* add_to_regexp(char *expr, const char *next);
/* configuration variables */
static int verbose = 0; /* -v */
static int do_update = 0; /* whether to call apt-get update */
+static int only_critical = 0; /* whether to warn about non-critical updates */
static upgrade_type upgrade = UPGRADE; /* which type of upgrade to do */
static char *upgrade_opts = NULL; /* options to override defaults for upgrade */
static char *update_opts = NULL; /* options to override defaults for update */
@@ -110,7 +111,7 @@ int main (int argc, char **argv) {
if(sec_count > 0){
result = max_state(result, STATE_CRITICAL);
- } else if(packages_available > 0){
+ } else if(packages_available > 0 && only_critical == 0){
result = max_state(result, STATE_WARNING);
} else if(result > STATE_UNKNOWN){
result = STATE_UNKNOWN;
@@ -148,12 +149,13 @@ int process_arguments (int argc, char **argv) {
{"include", required_argument, 0, 'i'},
{"exclude", required_argument, 0, 'e'},
{"critical", required_argument, 0, 'c'},
+ {"only-critical", no_argument, 0, 'o'},
{"input-file", required_argument, 0, INPUT_FILE_OPT},
{0, 0, 0, 0}
};
while(1) {
- c = getopt_long(argc, argv, "hVvt:u::U::d::ni:e:c:", longopts, NULL);
+ c = getopt_long(argc, argv, "hVvt:u::U::d::ni:e:c:o", longopts, NULL);
if(c == -1 || c == EOF || c == 1) break;
@@ -203,6 +205,9 @@ int process_arguments (int argc, char **argv) {
case 'c':
do_critical=add_to_regexp(do_critical, optarg);
break;
+ case 'o':
+ only_critical=1;
+ break;
case INPUT_FILE_OPT:
input_filename = optarg;
break;
@@ -463,7 +468,11 @@ print_help (void)
printf (" %s\n", _("upgrades for Debian and Ubuntu:"));
printf (" \t\%s\n", SECURITY_RE);
printf (" %s\n", _("Note that the package must first match the include list before its"));
- printf (" %s\n\n", _("information is compared against the critical list."));
+ printf (" %s\n", _("information is compared against the critical list."));
+ printf (" %s\n", "-o, --only-critical");
+ printf (" %s\n", _("Only warn about upgrades matching the critical list. The total number"));
+ printf (" %s\n", _("of upgrades will be printed, but any non-critical upgrades will not cause"));
+ printf (" %s\n\n", _("the plugin to return WARNING status."));
printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
printf (" %s\n", "-u, --update=OPTS");
diff --git a/plugins/t/check_apt.t b/plugins/t/check_apt.t
index 9ba0ff8..430eb53 100644
--- a/plugins/t/check_apt.t
+++ b/plugins/t/check_apt.t
@@ -23,7 +23,7 @@ sub make_result_regexp {
}
if (-x "./check_apt") {
- plan tests => 28;
+ plan tests => 36;
} else {
plan skip_all => "No check_apt compiled";
}
@@ -40,10 +40,18 @@ $result = NPTest->testCmd( sprintf($testfile_command, "", "debian2") );
is( $result->return_code, 1, "Debian apt output, warning" );
like( $result->output, make_result_regexp(13, 0), "Output correct" );
+$result = NPTest->testCmd( sprintf($testfile_command, "-o", "debian2") );
+is( $result->return_code, 0, "Debian apt output, no critical" );
+like( $result->output, make_result_regexp(13, 0), "Output correct" );
+
$result = NPTest->testCmd( sprintf($testfile_command, "", "debian3") );
is( $result->return_code, 2, "Debian apt output, some critical" );
like( $result->output, make_result_regexp(19, 4), "Output correct" );
+$result = NPTest->testCmd( sprintf($testfile_command, "-o", "debian3") );
+is( $result->return_code, 2, "Debian apt output, some critical" );
+like( $result->output, make_result_regexp(19, 4), "Output correct" );
+
$result = NPTest->testCmd( sprintf($testfile_command, "-c '^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'", "debian3") );
is( $result->return_code, 2, "Debian apt output - should have same result when default security regexp specified via -c" );
like( $result->output, make_result_regexp(19, 4), "Output correct" );
@@ -52,6 +60,10 @@ $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6", "debian3") );
is( $result->return_code, 1, "Debian apt output, filter for libc6" );
like( $result->output, make_result_regexp(3, 0), "Output correct" );
+$result = NPTest->testCmd( sprintf($testfile_command, "-i libc6", "debian3") );
+is( $result->return_code, 1, "Debian apt output, filter for libc6, not critical" );
+like( $result->output, make_result_regexp(3, 0), "Output correct" );
+
$result = NPTest->testCmd( sprintf($testfile_command, "-i libc6 -i xen", "debian3") );
is( $result->return_code, 2, "Debian apt output, filter for libc6 and xen" );
like( $result->output, make_result_regexp(9, 4), "Output correct" );
@@ -64,6 +76,10 @@ $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6", "debian3") );
is( $result->return_code, 2, "Debian apt output, filter out libc6" );
like( $result->output, make_result_regexp(16, 4), "Output correct" );
+$result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -o", "debian3") );
+is( $result->return_code, 2, "Debian apt output, filter out libc6, critical" );
+like( $result->output, make_result_regexp(16, 4), "Output correct" );
+
$result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -e xen", "debian3") );
is( $result->return_code, 1, "Debian apt output, filter out libc6 and xen" );
like( $result->output, make_result_regexp(10, 0), "Output correct" );

View file

@ -1,180 +0,0 @@
From 43ce70bcdbebb0b699bf936ac1763c423cd7f069 Mon Sep 17 00:00:00 2001
From: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Date: Mon, 16 Jan 2017 10:43:15 +0100
Subject: [PATCH] check_apt: Add -l/--list option to print packages
---
plugins/check_apt.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 65 insertions(+), 7 deletions(-)
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index c90b3df..b69680c 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -66,12 +66,17 @@ char* construct_cmdline(upgrade_type u, const char *opts);
/* run an apt-get update */
int run_update(void);
/* run an apt-get upgrade */
-int run_upgrade(int *pkgcount, int *secpkgcount);
+int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist);
/* add another clause to a regexp */
char* add_to_regexp(char *expr, const char *next);
+/* extract package name from Inst line */
+char* pkg_name(char *line);
+/* string comparison function for qsort */
+int cmpstringp(const void *p1, const void *p2);
/* configuration variables */
static int verbose = 0; /* -v */
+static int list = 0; /* list packages available for upgrade */
static int do_update = 0; /* whether to call apt-get update */
static int only_critical = 0; /* whether to warn about non-critical updates */
static upgrade_type upgrade = UPGRADE; /* which type of upgrade to do */
@@ -87,7 +92,8 @@ static int stderr_warning = 0; /* if a cmd issued output on stderr */
static int exec_warning = 0; /* if a cmd exited non-zero */
int main (int argc, char **argv) {
- int result=STATE_UNKNOWN, packages_available=0, sec_count=0;
+ int result=STATE_UNKNOWN, packages_available=0, sec_count=0, i=0;
+ char **packages_list=NULL, **secpackages_list=NULL;
/* Parse extra opts if any */
argv=np_extra_opts(&argc, argv, progname);
@@ -107,7 +113,7 @@ int main (int argc, char **argv) {
if(do_update) result = run_update();
/* apt-get upgrade */
- result = max_state(result, run_upgrade(&packages_available, &sec_count));
+ result = max_state(result, run_upgrade(&packages_available, &sec_count, &packages_list, &secpackages_list));
if(sec_count > 0){
result = max_state(result, STATE_CRITICAL);
@@ -130,6 +136,18 @@ int main (int argc, char **argv) {
sec_count
);
+ if(list) {
+ qsort(secpackages_list, sec_count, sizeof(char*), cmpstringp);
+ qsort(packages_list, packages_available-sec_count, sizeof(char*), cmpstringp);
+
+ for(i = 0; i < sec_count; i++)
+ printf("%s (security)\n", secpackages_list[i]);
+ if (only_critical == 0) {
+ for(i = 0; i < packages_available - sec_count; i++)
+ printf("%s\n", packages_list[i]);
+ }
+ }
+
return result;
}
@@ -146,6 +164,7 @@ int process_arguments (int argc, char **argv) {
{"upgrade", optional_argument, 0, 'U'},
{"no-upgrade", no_argument, 0, 'n'},
{"dist-upgrade", optional_argument, 0, 'd'},
+ {"list", no_argument, 0, 'l'},
{"include", required_argument, 0, 'i'},
{"exclude", required_argument, 0, 'e'},
{"critical", required_argument, 0, 'c'},
@@ -155,7 +174,7 @@ int process_arguments (int argc, char **argv) {
};
while(1) {
- c = getopt_long(argc, argv, "hVvt:u::U::d::ni:e:c:o", longopts, NULL);
+ c = getopt_long(argc, argv, "hVvt:u::U::d::nli:e:c:o", longopts, NULL);
if(c == -1 || c == EOF || c == 1) break;
@@ -196,6 +215,9 @@ int process_arguments (int argc, char **argv) {
if(update_opts==NULL) die(STATE_UNKNOWN, "strdup failed");
}
break;
+ case 'l':
+ list=1;
+ break;
case 'i':
do_include=add_to_regexp(do_include, optarg);
break;
@@ -222,7 +244,7 @@ int process_arguments (int argc, char **argv) {
/* run an apt-get upgrade */
-int run_upgrade(int *pkgcount, int *secpkgcount){
+int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist){
int i=0, result=STATE_UNKNOWN, regres=0, pc=0, spc=0;
struct output chld_out, chld_err;
regex_t ireg, ereg, sreg;
@@ -278,6 +300,11 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
cmdline);
}
+ *pkglist=malloc(sizeof(char *) * chld_out.lines);
+ if(!pkglist) die(STATE_UNKNOWN, "malloc failed!\n");
+ *secpkglist=malloc(sizeof(char *) * chld_out.lines);
+ if(!secpkglist) die(STATE_UNKNOWN, "malloc failed!\n");
+
/* parse the output, which should only consist of lines like
*
* Inst package ....
@@ -302,6 +329,9 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
if(regexec(&sreg, chld_out.line[i], 0, NULL, 0)==0){
spc++;
if(verbose) printf("*");
+ (*secpkglist)[spc-1] = pkg_name(chld_out.line[i]);
+ } else {
+ (*pkglist)[pc-spc-1] = pkg_name(chld_out.line[i]);
}
if(verbose){
printf("*%s\n", chld_out.line[i]);
@@ -368,6 +398,31 @@ int run_update(void){
return result;
}
+char* pkg_name(char *line){
+ char *start=NULL, *space=NULL, *pkg=NULL;
+ int len=0;
+
+ start = line + strlen(PKGINST_PREFIX);
+ len = strlen(start);
+
+ space = index(start, ' ');
+ if(space!=NULL){
+ len = space - start;
+ }
+
+ pkg=malloc(sizeof(char)*(len+1));
+ if(!pkg) die(STATE_UNKNOWN, "malloc failed!\n");
+
+ strncpy(pkg, start, len);
+ pkg[len]='\0';
+
+ return pkg;
+}
+
+int cmpstringp(const void *p1, const void *p2){
+ return strcmp(* (char * const *) p1, * (char * const *) p2);
+}
+
char* add_to_regexp(char *expr, const char *next){
char *re=NULL;
@@ -450,8 +505,11 @@ print_help (void)
printf (" %s\n", "-d, --dist-upgrade=OPTS");
printf (" %s\n", _("Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS"));
printf (" %s\n", _("can be provided to override the default options."));
- printf (" %s\n", " -n, --no-upgrade");
+ printf (" %s\n", "-n, --no-upgrade");
printf (" %s\n", _("Do not run the upgrade. Probably not useful (without -u at least)."));
+ printf (" %s\n", "-l, --list");
+ printf (" %s\n", _("List packages available for upgrade. Packages are printed sorted by"));
+ printf (" %s\n", _("name with security packages listed first."));
printf (" %s\n", "-i, --include=REGEXP");
printf (" %s\n", _("Include only packages matching REGEXP. Can be specified multiple times"));
printf (" %s\n", _("the values will be combined together. Any packages matching this list"));
@@ -490,5 +548,5 @@ void
print_usage(void)
{
printf ("%s\n", _("Usage:"));
- printf ("%s [[-d|-u|-U]opts] [-n] [-t timeout]\n", progname);
+ printf ("%s [[-d|-u|-U]opts] [-n] [-l] [-t timeout]\n", progname);
}

View file

@ -1,27 +0,0 @@
From 399cc141526ee77e1befce469f1fab40645f299d Mon Sep 17 00:00:00 2001
From: Bernard Spil <Sp1l@users.noreply.github.com>
Date: Mon, 6 Nov 2017 17:31:44 +0100
Subject: [PATCH] Fix build issue with MariaDB 10.2
Bug-Debian: https://bugs.debian.org/919395
As of 10.2 MariaDB no longer defines MYSQL_PORT.
---
plugins/common.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/plugins/common.h b/plugins/common.h
index 8719b502..6bf4fca4 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -174,6 +174,11 @@
*
*/
+/* MariaDB 10.2 client does not set MYSQL_PORT */
+#ifndef MYSQL_PORT
+# define MYSQL_PORT 3306
+#endif
+
enum {
OK = 0,
ERROR = -1

View file

@ -1,26 +0,0 @@
From 8520c643dd35bbeebbf36c7145d3f8c12dfaf70b Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@debian.org>
Date: Fri, 18 Jan 2019 22:52:54 +0100
Subject: [PATCH] Simply initializes n before it is used
When SSL is enabled, n is assigned the size of the server's second EHLO
response (I think in bytes), which will usually be significantly higher
than the command passed. As such, no commands are executed and no responses
are checked, which - silently - defeats the desired checks and results in a
success value.
---
plugins/check_smtp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 0fcf4c68..d37c57c8 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -293,6 +293,7 @@ main (int argc, char **argv)
printf("%s", buffer);
}
+ n = 0;
while (n < ncommands) {
xasprintf (&cmd_str, "%s%s", commands[n], "\r\n");
my_send(cmd_str, strlen(cmd_str));

View file

@ -1,39 +0,0 @@
From aa79ab278ffc9bf3d41207d97bdfb04be35b5c74 Mon Sep 17 00:00:00 2001
From: Sven Nierlein <sven@nierlein.de>
Date: Tue, 8 Dec 2020 16:24:10 +0100
Subject: [PATCH] check_mailq: restore accidentially removed options
with https://github.com/monitoring-plugins/monitoring-plugins/issues/381 -W and -C have been removed. It
would have been sufficient to only remove the long options. Restoring short options..
- fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954961
---
plugins-scripts/check_mailq.pl | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 32f498d3..aac1310e 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -568,7 +568,9 @@ ()
"w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number
"c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
- "s" => \$opt_s, "sudo" => \$opt_s
+ "s" => \$opt_s, "sudo" => \$opt_s,
+ "W=i" => \$opt_W, # warning if above this number
+ "C=i" => \$opt_C, # critical if above this number
);
if ($opt_V) {
@@ -662,8 +664,8 @@ ()
print " Feedback/patches to support non-sendmail mailqueue welcome\n\n";
print "-w (--warning) = Min. number of messages in queue to generate warning\n";
print "-c (--critical) = Min. number of messages in queue to generate critical alert ( w < c )\n";
- print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n";
- print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
+ print "-W = Min. number of messages for same domain in queue to generate warning\n";
+ print "-C = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n";
print "-s (--sudo) = Use sudo to call the mailq command\n";

View file

@ -1,9 +1,2 @@
02_check_icmp_links
# commited upstream
10_spell_fixes
11_check_dhcp_MSG_PEAK
12_check_apt_only_crit
13_check_apt_list_packages
14_mariadb
15_check_smtp_initialize
16_check_mailq_options