Added '-n name' back again. It's too useful to live without
authoraland <aland>
Mon, 31 Dec 2007 04:22:06 +0000 (04:22 +0000)
committeraland <aland>
Mon, 31 Dec 2007 04:22:06 +0000 (04:22 +0000)
man/man8/radiusd.8
src/include/radiusd.h
src/main/mainconfig.c
src/main/radiusd.c

index 1026444..e5d884a 100644 (file)
@@ -9,6 +9,8 @@ radiusd - Authentication, Authorization and Accounting server
 .RB [ \-f ]
 .RB [ \-i
 .IR ip-address ]
+.RB [ \-n
+.IR name ]
 .RB [ \-p
 .IR port ]
 .RB [ \-s ]
@@ -55,6 +57,8 @@ If this command-line option is given, then the "bind_address" and all
 This option MUST be used in conjunction with "-p".
 .IP \-f
 Do not fork, stay running as a foreground process.
+.IP "\-n 
+Read \fIraddb/name.conf\fP instead of \fIraddb/radiusd.conf\fP.
 .IP "\-p \fIport\fP"
 Normally radiusd listens on the ports specified in \fI/etc/services\fP
 (radius and radacct). When this option is given, radiusd listens on
index 09e3dab..6ca7c6f 100644 (file)
@@ -236,7 +236,7 @@ typedef struct main_config_t {
        int             radlog_fd;
        radlog_dest_t   radlog_dest;
        CONF_SECTION    *config;
-       const char      *radiusd_conf;
+       const char      *name;
        int             do_snmp;
 } MAIN_CONFIG_T;
 
index 779394c..5ff44d7 100644 (file)
@@ -553,8 +553,8 @@ int read_mainconfig(int reload)
        }
 
        /* Read the configuration file */
-       snprintf(buffer, sizeof(buffer), "%.200s/%.50s",
-                radius_dir, mainconfig.radiusd_conf);
+       snprintf(buffer, sizeof(buffer), "%.200s/%.50s.conf",
+                radius_dir, mainconfig.name);
        if ((cs = cf_file_read(buffer)) == NULL) {
                radlog(L_ERR, "Errors reading %s", buffer);
                return -1;
@@ -786,7 +786,6 @@ int free_mainconfig(void)
         *      structures.
         */
        cf_section_free(&mainconfig.config);
-       free(mainconfig.radiusd_conf);
        realms_free();
        listen_free(&mainconfig.listen);
        dict_free();
index 47be608..51cb731 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
        memset(&mainconfig, 0, sizeof(mainconfig));
        mainconfig.myip.af = AF_UNSPEC;
        mainconfig.port = -1;
-       mainconfig.radiusd_conf = strdup("radiusd.conf");
+       mainconfig.name = "radiusd";
 
 #ifdef HAVE_SIGACTION
        memset(&act, 0, sizeof(act));
@@ -182,6 +182,10 @@ int main(int argc, char *argv[])
                                flag |= 1;
                                break;
 
+                       case 'n':
+                               mainconfig.name = optarg;
+                               break;
+
                        case 'm':
                                debug_memory = 1;
                                break;
@@ -445,13 +449,14 @@ static void NEVER_RETURNS usage(int status)
        FILE *output = status?stderr:stdout;
 
        fprintf(output,
-                       "Usage: %s [-d db_dir] [-l log_dir] [-i address] [-fsvXx]\n", progname);
+                       "Usage: %s [-d db_dir] [-l log_dir] [-i address] [-n name] [-fsvXx]\n", progname);
        fprintf(output, "Options:\n\n");
        fprintf(output, "  -C              Check configuration and exit.\n");
        fprintf(output, "  -d raddb_dir    Configuration files are in \"raddbdir/*\".\n");
        fprintf(output, "  -f              Run as a foreground process, not a daemon.\n");
        fprintf(output, "  -h              Print this help message.\n");
        fprintf(output, "  -i ipaddr       Listen on ipaddr ONLY\n");
+       fprintf(output, "  -n name         Read raddb/name.conf instead of raddb/radiusd.conf\n");
        fprintf(output, "  -p port         Listen on port ONLY\n");
        fprintf(output, "  -s              Do not spawn child processes to handle requests.\n");
        fprintf(output, "  -v              Print server version information.\n");