[pkg-nagios-changes] [Git][nagios-team/monitoring-plugins][master] 3 commits: Adding d/p/18_check_icmp_help from upstream

Jan Wagner (@waja) gitlab at salsa.debian.org
Mon Dec 19 11:53:20 GMT 2022



Jan Wagner pushed to branch master at Debian Nagios Maintainer Group / monitoring-plugins


Commits:
76475e98 by Jan Wagner at 2022-12-19T11:21:56+00:00
Adding d/p/18_check_icmp_help from upstream

- - - - -
f625b1ed by Jan Wagner at 2022-12-19T11:47:59+00:00
Adding d/p/19_check_disk_fs_usage from upstream

- - - - -
50a63443 by Jan Wagner at 2022-12-19T11:52:14+00:00
Merge branch 'development'

- - - - -


3 changed files:

- + debian/patches/18_check_icmp_help
- + debian/patches/19_check_disk_fs_usage
- debian/patches/series


Changes:

=====================================
debian/patches/18_check_icmp_help
=====================================
@@ -0,0 +1,59 @@
+From e5db81bb29544b1be6500ad4a4dec5b4002c9962 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Aksel=20Sj=C3=B6gren?= <asjogren at itrsgroup.com>
+Date: Tue, 29 Nov 2022 13:55:32 +0100
+Subject: [PATCH] check_icmp: fix parsing help/version long options
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix parsing of the long options --help and --version. The special
+handling must be done before calling getopt().
+This fixes erroneous output like:
+
+    ./check_icmp --version
+    ./check_icmp: invalid option -- '-'
+    ./check_icmp: invalid option -- 'e'
+    ./check_icmp: invalid option -- 'r'
+    ./check_icmp: invalid option -- '-'
+    ./check_icmp: invalid option -- 'e'
+    ./check_icmp: invalid option -- 'r'
+
+Signed-off-by: Aksel Sjögren <asjogren at itrsgroup.com>
+---
+ plugins-root/check_icmp.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
+index f8f153512..1f87b75f9 100644
+--- a/plugins-root/check_icmp.c
++++ b/plugins-root/check_icmp.c
+@@ -451,6 +451,14 @@ main(int argc, char **argv)
+ 		packets = 5;
+ 	}
+ 
++	/* support "--help" and "--version" */
++	if(argc == 2) {
++		if(!strcmp(argv[1], "--help"))
++			strcpy(argv[1], "-h");
++		if(!strcmp(argv[1], "--version"))
++			strcpy(argv[1], "-V");
++	}
++
+ 	/* Parse protocol arguments first */
+ 	for(i = 1; i < argc; i++) {
+ 		while((arg = getopt(argc, argv, opts_str)) != EOF) {
+@@ -555,14 +563,6 @@ main(int argc, char **argv)
+ 	/* Parse extra opts if any */
+ 	argv=np_extra_opts(&argc, argv, progname);
+ 
+-	/* support "--help" and "--version" */
+-	if(argc == 2) {
+-		if(!strcmp(argv[1], "--help"))
+-			strcpy(argv[1], "-h");
+-		if(!strcmp(argv[1], "--version"))
+-			strcpy(argv[1], "-V");
+-	}
+-
+ 	argv = &argv[optind];
+ 	while(*argv) {
+ 		add_target(*argv);


=====================================
debian/patches/19_check_disk_fs_usage
=====================================
@@ -0,0 +1,46 @@
+From dd249c5d4bbce1c1250322dab8c8d0d69b0dca34 Mon Sep 17 00:00:00 2001
+From: christian-2 <49752982+christian-2 at users.noreply.github.com>
+Date: Tue, 13 Dec 2022 23:48:36 +0100
+Subject: [PATCH] check_disk: Find accessible mount path if multiple are
+ available (#1820)
+
+* fixes #1819
+* mount entries also have to be accessible according to get_fs_usage()
+---
+ lib/utils_disk.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/utils_disk.c b/lib/utils_disk.c
+index c7c9126e4..4f16068a7 100644
+--- a/lib/utils_disk.c
++++ b/lib/utils_disk.c
+@@ -28,6 +28,7 @@
+ 
+ #include "common.h"
+ #include "utils_disk.h"
++#include "gl/fsusage.h"
+ 
+ void
+ np_add_name (struct name_list **list, const char *name)
+@@ -127,9 +128,12 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
+       size_t name_len = strlen(d->name);
+       size_t best_match_len = 0;
+       struct mount_entry *best_match = NULL;
++      struct fs_usage fsp;
+ 
+       /* set best match if path name exactly matches a mounted device name */
+       for (me = mount_list; me; me = me->me_next) {
++	if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0)
++	  continue; /* skip if permissions do not suffice for accessing device */
+         if (strcmp(me->me_devname, d->name)==0)
+           best_match = me;
+       }
+@@ -137,6 +141,8 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
+       /* set best match by directory name if no match was found by devname */
+       if (! best_match) {
+         for (me = mount_list; me; me = me->me_next) {
++	  if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0)
++	    continue; /* skip if permissions do not suffice for accessing device */
+           size_t len = strlen (me->me_mountdir);
+           if ((exact == FALSE && (best_match_len <= len && len <= name_len &&
+              (len == 1 || strncmp (me->me_mountdir, d->name, len) == 0)))


=====================================
debian/patches/series
=====================================
@@ -6,3 +6,5 @@
 15_PRId64_PRIu64_2
 16_check_pgsql_dbname_too_strict
 17_check_curl_detect_ipv6
+18_check_icmp_help
+19_check_disk_fs_usage



View it on GitLab: https://salsa.debian.org/nagios-team/monitoring-plugins/-/compare/08ddb1eb4c51b5670ff15dc295700f99f7330ab0...50a63443888d66f509148e144180a4d35e6b7271

-- 
View it on GitLab: https://salsa.debian.org/nagios-team/monitoring-plugins/-/compare/08ddb1eb4c51b5670ff15dc295700f99f7330ab0...50a63443888d66f509148e144180a4d35e6b7271
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20221219/a07d860e/attachment-0001.htm>


More information about the pkg-nagios-changes mailing list