From: Alan T. DeKok Date: Sun, 17 Mar 2013 04:08:13 +0000 (-0400) Subject: Load all modules in the "mods-enabled" directory. X-Git-Tag: release_3_0_0_beta1~713 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88f956bb4973cbae59fc3df3f80809e855af1133;p=thirdparty%2Ffreeradius-server.git Load all modules in the "mods-enabled" directory. So that we don't need the "instantiate" section most of the time. --- diff --git a/raddb/radiusd.conf.in b/raddb/radiusd.conf.in index 6ae8b81e298..651ef1f182b 100644 --- a/raddb/radiusd.conf.in +++ b/raddb/radiusd.conf.in @@ -629,42 +629,17 @@ modules { # something defined by another module, you can list them in order # here, and ensure that the configuration will be OK. # +# After the modules listed here have been loaded, all of the modules +# in the "mods-enabled" directory will be loaded. Loading the +# "mods-enabled" directory means that unlike Version 2, you usually +# don't need to list modules here. +# instantiate { # - # Allows the execution of external scripts. - # The entire command line (and output) must fit into 253 bytes. - # - # e.g. Framed-Pool = `%{exec:/bin/echo foo}` - exec - - # - # The expression module doesn't do authorization, - # authentication, or accounting. It only does dynamic - # translation, of the form: - # - # Session-Timeout = `%{expr:2 + 3}` - # - # So the module needs to be instantiated, but CANNOT be - # listed in any other section. See 'doc/rlm_expr' for - # more information. - # - expr - - # - # The DHCP module currently just registers some DHCP related - # expansions, but will eventually contain all the code necessary - # for encoding and decoding DHCP packets. - # - dhcp - - - # - # We add the counter module here so that it registers + # We list the counter module here so that it registers # the check-name attribute before any module which sets # it # daily - expiration - logintime # subsections here can be thought of as "virtual" modules. # diff --git a/src/main/modules.c b/src/main/modules.c index dc1693482d6..961690ccf42 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -1458,6 +1458,31 @@ int setup_modules(int reload, CONF_SECTION *config) cf_log_info(cs, " }"); } /* if there's an 'instantiate' section. */ + /* + * Now that we've loaded the explicitly ordered modules, + * load everything in the "modules" section. This is + * because we've now split up the modules into + * mods-enabled. + */ + for (ci=cf_item_find_next(modules, NULL); + ci != NULL; + ci=next) { + const char *name; + module_instance_t *module; + CONF_SECTION *subcs; + + next = cf_item_find_next(modules, ci); + + if (!cf_item_is_section(ci)) continue; + + subcs = cf_itemtosection(ci); + name = cf_section_name2(subcs); + if (!name) name = cf_section_name1(subcs); + + module = find_module_instance(modules, name, 1); + if (!module) return -1; + } + /* * Loop over the listeners, figuring out which sections * to load.