From: Alan T. DeKok Date: Wed, 21 Aug 2024 00:00:08 +0000 (-0400) Subject: allow unlang inside of virtual modules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f44f82be619173977a4bbe8cbaba977e5c9f77b9;p=thirdparty%2Ffreeradius-server.git allow unlang inside of virtual modules --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index ace1be881ad..e6c26fc3cfd 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -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 diff --git a/src/lib/server/cf_priv.h b/src/lib/server/cf_priv.h index e70dd50044b..f0ad2262515 100644 --- a/src/lib/server/cf_priv.h +++ b/src/lib/server/cf_priv.h @@ -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;