#541148 nagios-plugins: check_http: detect invalid argument to -f

#541148#5
Date:
2009-08-11 23:15:11 UTC
From:
To:
--- nagios-plugins-1.4.12/debian/changelog
+++ nagios-plugins-1.4.12/debian/changelog
@@ -1,3 +1,11 @@
+nagios-plugins (1.4.12-4ubuntu2.1) jaunty; urgency=low
+
+  * Non-maintainer upload.
+  * Detect check_http -f=unknown-string, and support -f=valid-string (with
+    equal sign).
+
+ -- Justin Pryzby <justinpryzby@users.sourceforge.net>  Tue, 11 Aug 2009 16:09:45 -0700
+
 nagios-plugins (1.4.12-4ubuntu2) jaunty; urgency=low

   * Added 99_check_ntp_segfaults.dpatch: Fix for check_ntp and check_ntp_peer
--- nagios-plugins-1.4.12.orig/plugins/check_http.c
+++ nagios-plugins-1.4.12/plugins/check_http.c
@@ -302,16 +302,21 @@
         server_port = HTTPS_PORT;
       break;
     case 'f': /* onredirect */
+      if (*optarg=='=') ++optarg;
       if (!strcmp (optarg, "follow"))
         onredirect = STATE_DEPENDENT;
-      if (!strcmp (optarg, "unknown"))
+      else if (!strcmp (optarg, "unknown"))
         onredirect = STATE_UNKNOWN;
-      if (!strcmp (optarg, "ok"))
+      else if (!strcmp (optarg, "ok"))
         onredirect = STATE_OK;
-      if (!strcmp (optarg, "warning"))
+      else if (!strcmp (optarg, "warning"))
         onredirect = STATE_WARNING;
-      if (!strcmp (optarg, "critical"))
+      else if (!strcmp (optarg, "critical"))
         onredirect = STATE_CRITICAL;
+      else {
+        usage2 (_("Invalid option argument: --follow"), optarg);
+      }
+
       if (verbose)
         printf(_("option f:%d \n"), onredirect);
       break;

#541148#10
Date:
2009-08-12 07:51:52 UTC
From:
To:
Hi Justin,

maybe you did send your report to the wrong destination?
"submit@bugs.debian.org" is not ubuntu related. In case this was your
intention, please be so kind and write what your patch solves and what is the
problem related with it.

Thanks and with kind regards, Jan.

#541148#15
Date:
2009-08-27 15:16:52 UTC
From:
To:
Hi Jan,
We use ubuntu at my workplace, but I'm only familiar with bug
submission for Debian.  So I checked that this applies to the package
in debian's unstable, but forgot to change the version header.

check_http current allows --follow=foo or -f foo, but not -f=foo.
Also the implementation doesn't error when "foo" is an invalid string.
This patch allows -f=foo and errors if "foo" isn't a recognized
"follow" parameter.

Justin

#541148#20
Date:
2009-10-14 23:23:04 UTC
From:
To:
tag 541148 +wontfix
severity 541148 wishlist
thanks

Hi Justin,

please commit this patch upstream[1], actually I will not accept this patch.

Thanks and with kind regards, Jan.
[1] http://sourceforge.net/tracker/?func=add&group_id=29880&atid=397597