Add and document -F radutmp_file
authorAlan T. DeKok <aland@freeradius.org>
Mon, 26 Dec 2011 17:37:38 +0000 (12:37 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 26 Dec 2011 17:40:47 +0000 (12:40 -0500)
man/man1/radwho.1
src/main/radwho.c

index ed75468..c94fae8 100644 (file)
@@ -1,4 +1,4 @@
-.TH RADWHO 1 "7 April 2005" "" "FreeRADIUS Daemon"
+.TH RADWHO 1 "26 Dec 2011" "" "FreeRADIUS Daemon"
 .SH NAME
 radwho - show online users
 .SH SYNOPSIS
@@ -7,6 +7,8 @@ radwho - show online users
 .RB [ \-d
 .IR raddb_directory ]
 .RB [ \-f ]
+.RB [ \-F
+.IR radutmp_file ]
 .RB [ \-i ]
 .RB [ \-n ]
 .RB [ \-N
@@ -36,6 +38,9 @@ The directory that contains the RADIUS configuration files. Defaults to
 .IP \-f
 Behave as the 'fingerd' daemon - waits for one line of input, then
 prints the output with lines \\r\\n terminated.
+.IP \-F\ \fIradutmp_file\fP
+The file that contains the radutmp file.  If this is specified, -d is
+not necessary.
 .IP \-i
 Shows the session ID instead of the full name.
 .IP \-n
index 736c564..437ed8d 100644 (file)
@@ -270,6 +270,7 @@ static void NEVER_RETURNS usage(int status)
        fprintf(output, "       -d: set the raddb directory (default is %s)\n",
                RADIUS_DIR);
        fprintf(output, "       -f: give fingerd output\n");
+       fprintf(output, "       -F <file>: Use radutmp <file>\n");
        fprintf(output, "       -i: show session ID\n");
        fprintf(output, "       -n: no full name\n");
        fprintf(output, "       -N <nas-ip-address>: Show entries matching the given NAS IP address\n");
@@ -318,7 +319,7 @@ int main(int argc, char **argv)
 
        raddb_dir = RADIUS_DIR;
 
-       while((c = getopt(argc, argv, "d:fnN:sSipP:crRu:U:Z")) != EOF) switch(c) {
+       while((c = getopt(argc, argv, "d:fF:nN:sSipP:crRu:U:Z")) != EOF) switch(c) {
                case 'd':
                        raddb_dir = optarg;
                        break;
@@ -326,6 +327,9 @@ int main(int argc, char **argv)
                        fingerd++;
                        showname = 0;
                        break;
+               case 'F':
+                       radutmp_file = optarg;
+                       break;
                case 'h':
                        usage(0);
                        break;
@@ -400,6 +404,8 @@ int main(int argc, char **argv)
                exit(0);        /* don't bother printing anything else */
        }
 
+       if (radutmp_file) goto have_radutmp;
+
        /*
         *      Initialize mainconfig
         */
@@ -415,7 +421,7 @@ int main(int argc, char **argv)
        }
 
         /* Read the radutmp section of radiusd.conf */
-        cs = cf_section_sub_find(cf_section_sub_find(maincs, "modules"), "radutmp");
+        cs = cf_section_find_name2(cf_section_sub_find(maincs, "modules"), "radutmp", NULL);
         if(!cs) {
                 fprintf(stderr, "%s: No configuration information in radutmp section of radiusd.conf!\n",
                         argv[0]);
@@ -427,6 +433,7 @@ int main(int argc, char **argv)
        /* Assign the correct path for the radutmp file */
        radutmp_file = radutmpconfig.radutmp_fn;
 
+ have_radutmp:
        /*
         *      See if we are "fingerd".
         */