Code

Fix segfault in check_snmp (definitive fix is still in the works - see bug #2832451)
[nagiosplug.git] / plugins / check_http.c
index 5a859f98774bafa8513cbe64d91bb08fdfd277d2..79f6adf39962767c4d14a19d6d587c988afb6d8f 100644 (file)
@@ -305,18 +305,19 @@ process_arguments (int argc, char **argv)
     case 'f': /* onredirect */
       if (!strcmp (optarg, "stickyport"))
         onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST|STICKY_PORT;
-      if (!strcmp (optarg, "sticky"))
+      else if (!strcmp (optarg, "sticky"))
         onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST;
-      if (!strcmp (optarg, "follow"))
+      else if (!strcmp (optarg, "follow"))
         onredirect = STATE_DEPENDENT, followsticky = STICKY_NONE;
-      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 onredirect option"), optarg);
       if (verbose)
         printf(_("option f:%d \n"), onredirect);
       break;
@@ -789,7 +790,7 @@ check_http (void)
     die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n"));
 #ifdef HAVE_SSL
   if (use_ssl == TRUE) {
-    np_net_ssl_init(sd);
+    np_net_ssl_init_with_hostname(sd, host_name);
     if (check_cert == TRUE) {
       result = np_net_ssl_check_cert(days_till_exp);
       np_net_ssl_cleanup();
@@ -1406,8 +1407,8 @@ print_usage (void)
   printf (_("Usage:"));
   printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
   printf ("       [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n");
-  printf ("       [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n");
-  printf ("       [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n");
-  printf ("       [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n");
-  printf ("       [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n");
+  printf ("       [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n");
+  printf ("       [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
+  printf ("       [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
+  printf ("       [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n");
 }