From: Arran Cudbard-Bell Date: Wed, 23 May 2018 04:31:25 +0000 (+0600) Subject: Set main_config.dict_dir in radiusd.c X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c24d446061dc020eeecd3d6e245ca20e89852eec;p=thirdparty%2Ffreeradius-server.git Set main_config.dict_dir in radiusd.c --- diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index 2f263d83fb1..40de32eb468 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -735,14 +735,6 @@ int main_config_init(void) #endif INFO("Starting - reading configuration files ..."); - /* - * We need to load the dictionaries before reading the - * configuration files. This is because of the - * pre-compilation in conf_file.c. That should probably - * be fixed to be done as a second stage. - */ - if (!main_config.dict_dir) main_config.dict_dir = talloc_typed_strdup(NULL, DICTDIR); - /* * About sizeof(REQUEST) + sizeof(RADIUS_PACKET) * 2 + sizeof(VALUE_PAIR) * 400 * @@ -751,8 +743,10 @@ int main_config_init(void) main_config.talloc_pool_size = 8 * 1024; /* default */ /* - * Read the distribution dictionaries first, then - * the ones in raddb. + * We need to load the dictionaries before reading the + * configuration files. This is because of the + * pre-compilation in conf_file.c. That should probably + * be fixed to be done as a second stage. */ DEBUG2("Including dictionary file \"%s/%s\"", main_config.dict_dir, FR_DICTIONARY_FILE); if (fr_dict_from_file(&main_config.dict, FR_DICTIONARY_FILE) != 0) { @@ -919,8 +913,7 @@ do {\ return -1; } - default_log.dst = fr_str2int(log_str2dst, log_dest, - L_DST_NUM_DEST); + default_log.dst = fr_str2int(log_str2dst, log_dest, L_DST_NUM_DEST); if (default_log.dst == L_DST_NUM_DEST) { fprintf(stderr, "%s: Error: Unknown log_destination %s\n", main_config.name, log_dest); diff --git a/src/main/radiusd.c b/src/main/radiusd.c index b8d51e0eda6..9c0cddbe0b3 100644 --- a/src/main/radiusd.c +++ b/src/main/radiusd.c @@ -210,6 +210,11 @@ int main(int argc, char *argv[]) default_log.fd = -1; main_config.log_file = NULL; + /* + * Set the default dictionary directory + */ + main_config.dict_dir = DICTDIR; + /* * Set the panic action and enable other debugging facilities */ @@ -394,11 +399,6 @@ int main(int argc, char *argv[]) */ dl_init(); - /* - * Read the configuration files, BEFORE doing anything else. - */ - if (main_config_init() < 0) exit(EXIT_FAILURE); - /* * Initialise the top level dictionary hashes which hold * the protocols. @@ -408,6 +408,11 @@ int main(int argc, char *argv[]) fr_exit(EXIT_FAILURE); } + /* + * Read the configuration files, BEFORE doing anything else. + */ + if (main_config_init() < 0) exit(EXIT_FAILURE); + /* * Initialising OpenSSL once, here, is safer than having individual modules do it. * Must be called before display_version to ensure relevant engines are loaded.