Code

Standardize the extra-opts notes
[nagiosplug.git] / plugins / check_radius.c
index 37176257be8d276ee4adeb36d75870703e78d184..d5907ddebd3e058b2f67ef2368553ee532a49869 100644 (file)
@@ -63,6 +63,13 @@ void print_usage (void);
 #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(a, b, c, d)
 #define my_rc_read_dictionary(a) rc_read_dictionary(a)
 #endif
+
+/* REJECT_RC is only defined in some version of radiusclient. It has
+ * been reported from radiusclient-ng 0.5.6 on FreeBSD 7.2-RELEASE */
+#ifndef REJECT_RC
+#define REJECT_RC BADRESP_RC
+#endif
+
 int my_rc_read_config(char *);
 
 char *server = NULL;
@@ -195,13 +202,16 @@ main (int argc, char **argv)
                die (STATE_CRITICAL, _("Timeout"));
        if (result == ERROR_RC)
                die (STATE_CRITICAL, _("Auth Error"));
-       if (result == BADRESP_RC)
+       if (result == REJECT_RC)
                die (STATE_WARNING, _("Auth Failed"));
+       if (result == BADRESP_RC)
+               die (STATE_WARNING, _("Bad Response"));
        if (expect && !strstr (msg, expect))
                die (STATE_WARNING, "%s", msg);
        if (result == OK_RC)
                die (STATE_OK, _("Auth OK"));
-       return (0);
+       (void)snprintf(msg, sizeof(msg), _("Unexpected result code %d"), result);
+       die (STATE_UNKNOWN, msg);
 }
 
 
@@ -331,10 +341,10 @@ print_help (void)
 
        print_usage ();
 
-       printf (_(UT_HELP_VRSN));
-       printf (_(UT_EXTRA_OPTS));
+       printf (UT_HELP_VRSN);
+       printf (UT_EXTRA_OPTS);
 
-       printf (_(UT_HOST_PORT), 'P', myport);
+       printf (UT_HOST_PORT, 'P', myport);
 
        printf (" %s\n", "-u, --username=STRING");
   printf ("    %s\n", _("The user to authenticate"));
@@ -351,7 +361,7 @@ print_help (void)
   printf (" %s\n", "-r, --retries=INTEGER");
   printf ("    %s\n", _("Number of times to retry a failed connection"));
 
-       printf (_(UT_TIMEOUT), timeout_interval);
+       printf (UT_TIMEOUT, timeout_interval);
 
   printf ("\n");
   printf ("%s\n", _("This plugin tests a RADIUS server to see if it is accepting connections."));
@@ -364,13 +374,7 @@ print_help (void)
   printf ("%s\n", _("run the plugin at regular predictable intervals. Please be sure that"));
   printf ("%s\n", _("the password used does not allow access to sensitive system resources."));
 
-#ifdef NP_EXTRA_OPTS
-  printf ("\n");
-  printf ("%s\n", _("Notes:"));
-  printf (_(UT_EXTRA_OPTS_NOTES));
-#endif
-
-       printf (_(UT_SUPPORT));
+       printf (UT_SUPPORT);
 }