Code

first revised patch failed to trap the "break" in while()
[nagiosplug.git] / plugins / check_radius.c
index 614d467bc520b1d94e594d3663510734935436ba..c71f3b4c37772de2d345c5c065568b77fec53d5b 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
-#define PROGNAME "check_radius"
+const char *progname = "check_radius";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHORS "Robert August Vincent II/Karl DeBisschop"
@@ -52,7 +52,7 @@
     Number of times to retry a failed connection\n\
  -t, --timeout=INTEGER\n\
     Seconds before connection times out (default: %d)\n\
- -v\n\
+ -v, --verbose\n\
     Show details for command-line debugging (do not use with nagios server)\n\
  -h, --help\n\
     Print detailed help screen\n\
     Print version information\n"
 
 #define DESCRIPTION "\
-The password option presents a substantial security issue because the 
-password can be determined by careful watching of the command line in
-a process listing.  This risk is exacerbated because nagios will
-run the plugin at regular prdictable intervals.  Please be sure that
-the password used does not allow access to sensitive system resources,
+This plugin tests a radius server to see if it is accepting connections.\n\
+\n\
+The server to test must be specified in the invocation, as well as a user\n\
+name and password. A configuration file may also be present. The format of\n\
+the configuration file is described in the radiusclient library sources.\n\
+\n\
+The password option presents a substantial security issue because the\n\
+password can be determined by careful watching of the command line in\n\
+a process listing.  This risk is exacerbated because nagios will\n\
+run the plugin at regular prdictable intervals.  Please be sure that\n\
+the password used does not allow access to sensitive system resources,\n\
 otherwise compormise could occur.\n"
 
 #include "config.h"
@@ -106,7 +112,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
@@ -128,7 +134,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
 
 <sect2>
 <title>Future Enhancements</title>
-<para>ToDo List</para>
+<para>Todo List</para>
 <itemizedlist>
 <listitem>Add option to get password from a secured file rather than the command line</listitem>
 </itemizedlist>
@@ -202,7 +208,6 @@ process_arguments (int argc, char **argv)
 {
        int c;
 
-#ifdef HAVE_GETOPT_H
        int option_index = 0;
        static struct option long_options[] = {
                {"hostname", required_argument, 0, 'H'},
@@ -218,7 +223,6 @@ process_arguments (int argc, char **argv)
                {"help", no_argument, 0, 'h'},
                {0, 0, 0, 0}
        };
-#endif
 
        if (argc < 2)
                return ERROR;
@@ -245,27 +249,22 @@ process_arguments (int argc, char **argv)
        }
 
        while (1) {
-#ifdef HAVE_GETOPT_H
-               c =
-                       getopt_long (argc, argv, "+hVvH:P:F:u:p:t:r:e:", long_options,
+               c = getopt_long (argc, argv, "+hVvH:P:F:u:p:t:r:e:", long_options,
                                                                         &option_index);
-#else
-               c = getopt (argc, argv, "+hVvH:P:F:u:p:t:r:e:");
-#endif
 
                if (c == -1 || c == EOF || c == 1)
                        break;
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
@@ -318,7 +317,7 @@ process_arguments (int argc, char **argv)
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
@@ -334,12 +333,7 @@ void
 print_usage (void)
 {
        printf ("Usage:\n" " %s %s\n"
-#ifdef HAVE_GETOPT_H
                                        " %s (-h | --help) for detailed help\n"
                                        " %s (-V | --version) for version information\n",
-#else
-                                       " %s -h for detailed help\n"
-                                       " %s -V for version information\n",
-#endif
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }