[Pkg-nagios-devel] Bug#541148: nagios-plugins: check_http: detect invalid argument to -f

Justin Pryzby justinpryzby at users.sourceforge.net
Tue Aug 11 23:15:11 UTC 2009


Package: nagios-plugins
Version: 1.4.12-4ubuntu2
Tags: patch

--- 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 at 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;





More information about the Pkg-nagios-devel mailing list