]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow unlang inside of virtual modules
authorAlan T. DeKok <aland@freeradius.org>
Wed, 21 Aug 2024 00:00:08 +0000 (20:00 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 21 Aug 2024 11:01:07 +0000 (07:01 -0400)
src/lib/server/cf_file.c
src/lib/server/cf_priv.h

index ace1be881ade57a3ddd6329ca7c0396c281f5487..e6c26fc3cfd49d817a3d8c52e186352cb3fa65f1 100644 (file)
@@ -2207,14 +2207,6 @@ static int parse_input(cf_stack_t *stack)
 
        /*
         *      See which unlang keywords are allowed
-        *
-        *      Note that the "modules" section now allows virtual
-        *      modules.  See module_rlm.c.
-        *
-        *      - group
-        *      - redundant
-        *      - redundant-load-balance
-        *      - load-balance
         */
        if (parent->unlang != CF_UNLANG_ALLOW) {
                if ((strcmp(buff[1], "if") == 0) ||
@@ -2374,6 +2366,7 @@ check_for_eol:
 
                        if (strcmp(css->name1, "server") == 0) css->unlang = CF_UNLANG_SERVER;
                        if (strcmp(css->name1, "policy") == 0) css->unlang = CF_UNLANG_POLICY;
+                       if (strcmp(css->name1, "modules") == 0) css->unlang = CF_UNLANG_MODULES;
 
                } else if (parent->unlang == CF_UNLANG_POLICY) {
                        /*
@@ -2406,6 +2399,22 @@ check_for_eol:
                                css->allow_locals = false;
                        }
 
+               } else if (parent->unlang == CF_UNLANG_MODULES) {
+                       /*
+                        *      Virtual modules in the "modules" section can have unlang.
+                        */
+                       if ((strcmp(css->name1, "group") == 0) ||
+                           (strcmp(css->name1, "load-balance") == 0) ||
+                           (strcmp(css->name1, "redundant") == 0) ||
+                           (strcmp(css->name1, "redundant-load-balance") == 0)) {
+                               css->unlang = CF_UNLANG_ALLOW;
+                               css->allow_locals = true;
+
+                       } else {
+                               css->unlang = CF_UNLANG_NONE;
+                               css->allow_locals = false;
+                       }
+
                } else if (parent->unlang == CF_UNLANG_EDIT) {
                        /*
                         *      Edit sections canb only have children
index e70dd50044b3285ab242b11aa9c733afe882bb7c..f0ad2262515d17e372e9b1f3ae9c5b826df5b237 100644 (file)
@@ -88,6 +88,7 @@ typedef enum {
        CF_UNLANG_ALLOW,                        //!< allow unlang in this section
        CF_UNLANG_SERVER,                       //!< this section is a virtual server, allow unlang 2 down
        CF_UNLANG_POLICY,                       //!< this section is a policy, allow unlang 2 down
+       CF_UNLANG_MODULES,                      //!< this section is in "modules", allow unlang 2 down
        CF_UNLANG_EDIT,                         //!< only edit assignments
 } cf_unlang_t;