>
>Andrea Gabellini <[EMAIL PROTECTED]> wrote:
> > I notice that if I pass the -d option to radwho, it reads the correct
> > radiusd.conf but don't read the radutmp file defined in the radutmp
>modules
> > section.
> >
> > Looking trought the source code seems it don't search for any parameters
>at
> > all.
> >
> > Any idea?
>
>   Submit a patch?
>
>   Alan DeKok.

Alan,

I hope this is logically correct. It works for me.

Andrea

--- radwho.c.orig       2002-08-16 10:25:24.780004000 +0200
+++ radwho.c    2002-08-16 14:59:59.210005000 +0200
@@ -91,6 +91,15 @@
  int log_stripped_names;
  struct main_config_t mainconfig;

+struct radutmp_config_t {
+  char *radutmp_fn;
+} radutmpconfig;
+
+static CONF_PARSER module_config[] = {
+  { "filename", PW_TYPE_STRING_PTR, 0, &radutmpconfig.radutmp_fn,  RADUTMP },
+  { NULL, -1, 0, NULL, NULL }
+};
+
  /*
   *     A mapping of configuration file names to internal variables
   */
@@ -363,7 +372,6 @@
         int c, portno;

         radius_dir = strdup(RADIUS_DIR);
-       radutmp_file = strdup(RADUTMP);

         while((c = getopt(argc, argv, "d:flhnsipcr")) != EOF) switch(c) {
                 case 'd':
@@ -418,6 +426,19 @@
         }
         cf_section_parse(cs, NULL, server_config);

+       /* Read the radutmp section of radiusd.conf */
+       cs = cf_section_sub_find(cf_section_find("modules"), "radutmp");
+       if(!cs) {
+               fprintf(stderr, "%s: No configuration information in 
radutmp section of radiusd.conf!\n",
+                       argv[0]);
+               exit(1);
+       }
+
+       cf_section_parse(cs, NULL, module_config);
+
+       /* Assign the correct path for the radutmp file */
+       radutmp_file = radutmpconfig.radutmp_fn;
+
         /*
          *      See if we are "fingerd".
          */
@@ -500,7 +521,7 @@
         /*
          *      Show the users logged in on the terminal server(s).
          */
-       if ((fp = fopen(RADUTMP, "r")) == NULL)
+       if ((fp = fopen(radutmp_file, "r")) == NULL)
                 return 0;

         if (!hdrdone) {



>-
>List info/subscribe/unsubscribe? See
>http://www.freeradius.org/list/users.html


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to