]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Load all modules in the "mods-enabled" directory.
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Mar 2013 04:08:13 +0000 (00:08 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 17 Mar 2013 04:08:13 +0000 (00:08 -0400)
So that we don't need the "instantiate" section most of the time.

raddb/radiusd.conf.in
src/main/modules.c

index 6ae8b81e298e9ac343c54547697a5713b37284b1..651ef1f182ba6bb5291c0ec53e0143f08ad47468 100644 (file)
@@ -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.
        #
index dc1693482d6d0422c7540dde719cc5bf1e991ef9..961690ccf42d632c350b887fd90abefb32b83873 100644 (file)
@@ -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.